Open mylanconnolly opened 10 months ago
Interesting idea. We'd re-use the override go_type
parsing logic I think, and we'd need to add an import to the output.
I think the plugin idea is a good starting point though. We just released sqlc-gen-go
which is the sqlc built-in Go codegen package extracted for use as an external plugin. It should be relatively straightforward for you to fork and modify that plugin to see if this approach works. If it's not straightforward then let us know so that we can improve our documentation.
What do you want to change?
I wanted to try out Service Weaver with sqlc since sqlc is such a joy to use, however I ran into a slight issue. Service Weaver requires you to implement the
encoding.BinaryMarshaler
andencoding.BinaryUnmarshaler
interfaces. There is a shortcut where you could embedweaver.AutoMarshal
into the struct. I was thinking that it might be a nice enhancement to make this use-case a bit easier to handle so I won't have to write a bunch of functions for generated structs.Basically, I was envisioning something like:
Alternatively, is this something that could be accomplished with plugins?
Thanks so much!
What database engines need to be changed?
No response
What programming language backends need to be changed?
Go