19 ms·
IMO the best value of the ORM is not in the object relational mapping part, but in type synchronization between the DB and a client. Thus there's a wave of rece
by threatofrain 3y ago
IMO the best value of the ORM is not in the object relational mapping part, but in type synchronization between the DB and a client. Thus there's a wave of recent enthusiasm for ORM-lite solutions.
- codeptualize 3y agoVery much agree with this. I really like how sqlx (on rust) does it. You just write normal SQL queries, and it will check and validate the types against your db. Best of both worlds.
- codeptualize 3y agoI 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.
- jd3 3y agofrom my experience working for a globally distributed django shop, orm mapping/type synchronization are both small fry compared to query building this now 400+ headcount company would not exist if query builders did not exist