5 ms·
sqlc is a great code generator that seems to work miracles. It uses the official postgres parser to know all the types of your tables and queries, and can gene
by Andys 5y ago
sqlc is a great code generator that seems to work miracles.
It uses the official postgres parser to know all the types of your tables and queries, and can generate perfect Go structs from this.
It even knows your table and field types just from reading your migrations, tracking changes perfectly, no need to even pg_dump a schema definition.
I also found it works fine with cockroachdb.
- evandwight 5y agoHow are migrations defined? I ask because I'm still trying to find a good solution for my project.
- Andys 5y agoit supports the migration files of several different Go migrator modules. Usually just a series of text .sql files with up/down sections.