-
Notifications
You must be signed in to change notification settings - Fork 44
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
slice, array: interface must be a pointer to a struct #6
Comments
Hey @themihai currently that is correct, as the description states however, it actually might not be that hard to also decode directly into variables such as arrays or maps. I will look into the possibility of adding this tonight after I get off work; thanks for the idea. |
You're right! I was quick to jump on the "Supported Types" section instead to read documentation more thoroughly. Support for direct values would be nice as it would put query encoding on par with the other formats(i.e. json). |
I've tried a quick decoding implementation of direct struct slices(just hooked-up the slice decoding method into the main Decode function) but unfortunately some tests(see the commented out lines) are failing. These seem to be related to maps and arrays of the struct properties so I guess I'm missing some important steps in the decoding process. |
Hey @themihai It is a good attempt, I think you just may be overcomplicating it; all of the logic already exists to parse slices and maps, what I was thinking was change this line to call setFieldByType and the rest should handle itself, at least that's the theory ;) UPDATE: oh and put the traverseStruct in an else{} |
Hey @themihai just an FYI, I've completed the Decoder portion of these changes and if all goes well will finish up making the same changes to Encoder in the morning and will then cut a new release |
Indeed, it was easier than I thought! Looking forward for the updates! With this change the encoder supports pretty much any valid data type including basic types. |
Hey @themihai this change has been made is in Release 2.0.0 if there are any issues please don't hesitate to reopen. |
Hey @themihai just checking to make sure this is working out for you? |
It seems slice and array types are supported only on struct properties.
The text was updated successfully, but these errors were encountered: