You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both examples above will have the same output (user.LastName == "") but how can I figure out if one is default value from Go struct and the other it's a input from user?
I need this because of some validations in business rule inside of my app. If user put the field, for example lname I make one thing but if not I make another thing.
I just write this question in gopher#api Slack channel and the workaround was to use pointer, but for me it isn't elegant. Is there some other approach for this problem?
Many tks
The text was updated successfully, but these errors were encountered:
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
I am looking for some approach to work with default values from a json decoder.
What version of Go are you using (
go version
)?Example
Both examples above will have the same output (
user.LastName == ""
) but how can I figure out if one is default value from Go struct and the other it's a input from user?I need this because of some validations in business rule inside of my app. If user put the field, for example lname I make one thing but if not I make another thing.
I just write this question in gopher#api Slack channel and the workaround was to use pointer, but for me it isn't elegant. Is there some other approach for this problem?
Many tks
The text was updated successfully, but these errors were encountered: