goreflect / gostructor

Go configurator structures library

Home Page:https://goreflect.github.io/gostructor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support json config file

kubitre opened this issue · comments

need supporting parse configure from json configuration file.
Start in go file: json_func.go
everything you should know about this case - in your configure struct.

In this case you should parse json configuration format by structure field path, for example:

{
    "testCase": {
          "MyStruct": {
                 "FieldTest1": "testResult1"
           }
     }
}

and model in go:

type MyStruct struct {
      FieldTest1 string
} `cf_json:"testCase"`

Function should be understand that need parse testCase.MyStruct.FieldTest1 into go model MyStruct.FieldTest1

and also this function should be understand this type:

"testCase": {
          "MyStruct": {
                 "Field": "testResult1"
           }
     }
type MyStruct struct {
      FieldTest1 string `cf_json:"Field"`
} `cf_json:"testCase"`

And also, after complete #7 you should add to this func any which you middlewares will be accepted like validate or any

Need support all of this types: int8, int16, int32, int64, float16, float32, float64, string, bool, char, slice, map