4 ms·
What would you use if ORM is to be avoided? Perhaps something like https://github.com/sqlc-dev/sqlc https://github.com/sqlc-dev/sqlc ?
by anta40 2y ago
What would you use if ORM is to be avoided?
Perhaps something like https://github.com/sqlc-dev/sqlc https://github.com/sqlc-dev/sqlc ?
- Daril 2y agoI'm using this at the moment : https://jmoiron.github.io/sqlx/ https://jmoiron.github.io/sqlx/ Didnt' now about sqlc, it seems very interesting ! Thanks for sharing !
- sunaookami 2y agoSeconding sqlx, it's wonderful, is not an ORM and doesn't need code gen.
- leetrout 2y agosqlc is _excellent_ if you are comfortable with its limitations. I love it even though I don't love optional fields query pattern with NULL.
- kflgkans 2y agoMy advice is to just use standard library `database/sql`. Every abstraction on top adds extra complexity and isn't really necessary. Just execute a query, map the results, and there you go.
- InsideOutSanta 2y ago"Every abstraction on top adds extra complexity and isn't really necessary" This. In my experience, every project that has non-trivial query requirements starts out as "this ORM is nice, it takes away 90% of my work" and ends with "how do I get rid of that leaky abstraction layer that constantly makes my life harder."
- Taikonerd 2y agoI would say: SQL is a DSL for interacting with DBs. If it's not doing what you want, consider a different DSL, like Gel, SurrealDB, or PRQL. These also have the advantage of being programming language-agnostic.