Skip to content

Avoid writing converters #3086

Discussion options

You must be logged in to vote

Hi, so the same thing happens for any other codegen such as sqlc models.

If the structs have identical fields, you can use Go's inbuilt struct conversion.

In order to convert between mostly identical structs, you can use https://github.com/jmattheis/goverter , https://github.com/mitchellh/mapstructure or a few other libraries.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nareshbhatia
Comment options

Answer selected by nareshbhatia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants