3 ms·
I mainly checked out sqlx as it seemed like compile-time checked queries gave some of the advantages of sqlc in Go. However, I was a bit disappointed. Compile t
by jchw 4y ago
I mainly checked out sqlx as it seemed like compile-time checked queries gave some of the advantages of sqlc in Go. However, I was a bit disappointed. Compile time checking requires you to connect to a database at compile time, with the schema already set up. Sqlc doesn't even require this at codegen time in Go, at the cost of needing to emulate some of the underlying database behaviors. I'm sure it's not a deal breaker to everyone, but I find the premise of needing a database to make queries against for every single build to be way, way, way too much baggage.
The idea of checking the queries against a schema is great. Even better if you can use it to infer arguments and return types.
- rubenfiszel 4y agoI can see where this would be inconvenient. I write the migrations first so it doesn't bother me, but for prototyping it sure seems cooler to not even require the schema to exist.
- norman784 4y agoThere's an offline feature that > Enables building the macros in offline mode when a live database is not available (such as CI) [0] [0] https://github.com/launchbadge/sqlx/blob/76ae2865005cc79d56972d68d3be30805581103d/README.md?plain=1#L182-L183 https://github.com/launchbadge/sqlx/blob/76ae2865005cc79d569...