8 ms·
I can't find an equivalent for Go. https://github.com/sqlc-dev/sqlc https://github.com/sqlc-dev/sqlc and https://github.com/sqlc-dev/sqlc https://github.com/sql
by codeptualize 3y ago
I can't find an equivalent for Go. https://github.com/sqlc-dev/sqlc https://github.com/sqlc-dev/sqlc and https://github.com/sqlc-dev/sqlc https://github.com/sqlc-dev/sqlc look nice, but they are doing codegen, definitely not as sleek as Rust sqlx.
I guess it's a good example of how powerful Rust is. The "magic" that sqlx does at compile time gets really difficult if not impossible to do without macros.
Of course you could create a separate parser/builder, and codegen works as well, but definitely not as convenient and flexible.
- Yoric 3y agoDiesel (also in Rust world) has pretty good mappings to SQL. There are derives involved, of course, so that probably counts as macros.
- Two4 3y agoYou've pasted the same link twice, I think
- xarope 3y agoI've found a happy medium, where I use sql-migrate to build the database, and go-jet to generate the table/model structures for use in go, and go-jet's syntax is reasonably close to SQL that it's easy enough for expression. caveat: I'm an ex-DBA so I'm comfortable with building complex tables, relationships and queries. Less familiar folks might struggle building the tables, relationships, and doing joins, ctes etc.