Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to map result to struct? #25

Closed
vojbarzz opened this issue Oct 26, 2018 · 1 comment
Closed

How to map result to struct? #25

vojbarzz opened this issue Oct 26, 2018 · 1 comment
Labels
question Further information is requested

Comments

@vojbarzz
Copy link

vojbarzz commented Oct 26, 2018

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 :(

@thedevsaddam thedevsaddam added the question Further information is requested label Oct 26, 2018
@thedevsaddam
Copy link
Owner

You can iterate over the []interface{} and populate your struct (this is good but you need to assert the value yourself)

Or you can encode to json and write the byte to the struct by decoding json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants