sqlc
sqlc copied to clipboard
Add support for omitempty in JSON tags
Adds a new configuration option json_tags_omit_empty which adds omitempty
to JSON tags.
Closes https://github.com/sqlc-dev/sqlc/issues/1098 Closes https://github.com/sqlc-dev/sqlc/issues/1084
Related To: https://github.com/sqlc-dev/sqlc/discussions/1132 https://github.com/sqlc-dev/sqlc/discussions/1087
What's the progress on this? Is this PR just waiting for a review?
Thoughts on an option for setting omitempty
on nullable fields only? Slightly more of a pain to implement since JSONTagName
doesn't know the nullability of its field.
Is there an updated status here? Seems like a good fix
I don't know if the quality of the code is good, but this feature looks valuable. Reusing the sqlc-generated structs would be great. If they can be extended in any way via config options like this one, it makes them versitile.