dynamic-struct
dynamic-struct copied to clipboard
Golang package for editing struct's fields during runtime and mapping structs to other structs.
With this fix, the following code will output the expected result, **tested on MaxOS and Linux**: `go get -u github.com/mtt0/dynamic-struct@0e75835bc641757dac062453629f1300ea57678c` - go.mod ```go module main go 1.13 require github.com/mtt0/dynamic-struct v1.3.1-0.20220614084457-0e75835bc641...
Thanks for making this great tool. It is very useful for GraphQL query which requires dynamic struct sometimes. One feature seems missing is not supported embedded dynamic struct. For example,...
` instance := dynamicstruct.NewStruct(). AddField("Integer", 0, `json:"int"`). AddField("Text", "", `json:"someText"`). AddField("Float", 0.0, `json:"double"`). AddField("Boolean", false, ""). AddField("Slice", []interface{}{}, ""). AddField("Anonymous", "", `json:"-"`). Build(). New() data := []byte(` { "int": 123,...
I'm looking for the example how to change the type of a field
for example how we create similar struct from example: ```go type Yaml struct { Name string `yaml:"name"` Version string `yaml:"version"` Datasets []Datasets `yaml:"datasets"` } type Datasets struct { Name string...
I see that last year support for [embedded structs](https://github.com/Ompluscator/dynamic-struct/commit/0e75835bc641757dac062453629f1300ea57678c) was added, but it doesn't enable the builder to create a type with embedded structs. Something like this: ```go type stitle...
NewSliceOfStructs() currently returns slice of dynamic struct with 0 capcity. This is causing memory leak issues in my case (where we need to unmarshall sqlx.Rows output to slice of dynamic...