gocqlx
gocqlx copied to clipboard
schemagen: generate go structs for tables
This is a followup to #201. We can now generate the table model but still the structs need to written by hand.
Gocqlx supports UDTs automatically by embedding a special marker interface. Plain fields should be simple to generate.
Overall the tool should gain ability to generate the table structs.
@Bobochka maybe you would be interested in this one.
Hey @mmatczuk, I would like to work on this. I already started doing something, can you take a look? https://github.com/pavle995/gocqlx/tree/structs-tables
Nice work, keep it up, it needs some testing. It will be required to change from gocql.UUID to a different UUID type.
Thanks for guidelines. I've added test for map_types.go and updated existing test for schemagen.go. I've also added example in test_examples.go. I've changed from gocql.UUID to [16]byte. This may be a silly question, but why we can't use gocql.UUID?
There are so many uuid types, we allow for flexibility. I think the point here is to be able to configure the tool to provide a custom import path for UUID. Please send a PR if you think this is ready.
Any update on this issue?