Browse Source

Updated README

  * Commented on how AutoStruct isn't 100% accurate at getting the type
of some things.
  * Commented on the 2 examples this project provides (main, main2)
Apollo 2 years ago
parent
commit
fe7566d756
1 changed files with 24 additions and 1 deletions
  1. 24 1
      README.md

+ 24 - 1
README.md

@@ -2,5 +2,28 @@
 
 Given unknown json but want nice clean structures to load it consistently?
 
-AutoStruct should help with that.
+AutoStruct can help with that.
 
+## This isn't a end-all-be-all
+
+AutoStruct was designed to aid those who had lots of json that they wanted to properly load into json, but found that the json package doesn't support dynamically loading (especially nested json like `{}`s or `[]`s), AutoStruct catches most cases and will attempt to use a best fix method (if it can use for example `[]string` or `[]int` it will, but if the types vary it has no choice but to make a separate structure to handle that).
+
+> It is always recommended to check the output of AutoStruct and make changes as needed. (Also note that if you changed something you might want to make a note of that in another file because AutoStruct will most likely eat any changes and default back to the original output if run again)
+
+## Examples
+
+There are currently 2 examples to AutoStruct.
+
+### Main
+
+There is `main.go` in the examples directory, issuing `go run main.go` should cause a fresh copy of example.go to be produced.
+
+This example shows that go code can now write structures and import and define the package.
+
+### Main2
+
+There is `main2.go` in the examples directory, issuing `go run main2.go` should cause a fresh copy of example2.go to be produced from the json input `simple.json`.
+
+This example shows that we can have go code generated from json.
+
+> This example also shows that AutoStruct is guessing the type of the JSON, it really doesn't know, as such if it's not sure it will most likely end up with a type `interface{}`, just to prove that this isn't to replace the programmer, just to reduce the hours spent making the structures of the json being given.