Closed vojbarzz closed 5 years ago
Hello, having following query applications.WhereEqual("reporting", false).Select("applications").Only("id", "name") and need to map it to struct.
applications.WhereEqual("reporting", false).Select("applications").Only("id", "name")
Example of return value is [map[id:1.94664978e+08] map[id:1.12640692e+08] map[id:1.94411185e+08]]
[map[id:1.94664978e+08] map[id:1.12640692e+08] map[id:1.94411185e+08]]
Could You suggest how? Having no idea :(
You can iterate over the []interface{} and populate your struct (this is good but you need to assert the value yourself)
[]interface{}
Or you can encode to json and write the byte to the struct by decoding json
encode to json
decoding json
Hello, having following query
applications.WhereEqual("reporting", false).Select("applications").Only("id", "name")
and need to map it to struct.Example of return value is
[map[id:1.94664978e+08] map[id:1.12640692e+08] map[id:1.94411185e+08]]
Could You suggest how? Having no idea :(