-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
doc.Unmarshal does not play well with json
tag
#142
Comments
I made a local copy of clover/internal/encoding.go and updated createRenameMap as follows:
|
actually, the json tag should be always be checked, not just when the clover tag is found. |
@semolex: thank you for reporting the issue. @univac490: could you submit a PR? |
Merged
@semolex: please check if still have the issue. |
@ostafen Thanks. Confirmed. Waiting for a next release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Clover DB team,
I've encountered an issue while integrating Clover DB with the Wails framework. It seems that when using struct tags for JSON unmarshaling alongside Clover's own tags, the unmarshaled struct ends up with default values for certain fields, rather than the values stored in the database.
Environment:
Steps to Reproduce
Expected Behavior
The struct fields should reflect the values stored in the database.
Actual Behavior
Some fields in the struct are set to their default Go values, despite having different values stored in the database.
Example
{Id:124b0a50-a6ce-4297-8718-69553f9c4222 Name:Test if marshalling works BalanceActual:0 ManagerId:"" BalanceByAccount:0 IsWorker:false}
I receive this unmarshaled result on frontend (with json-specified fields e.g.
snake_case
).Is there is some undocumented way to use both tags or some designed way to specify those fields?
I could definitely use are maps but in a certain way I am using type validations, possible method calls etc.
Thank you for looking into this issue. I am looking forward to your response or guidance on how to address this problem.
The text was updated successfully, but these errors were encountered: