Our great sponsors
-
sqlx
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite. (by launchbadge)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
The sqlx library is what I hope to see the next generation of ORMs to look like though technically it's anti-ORM in a lot of ways. Embracing the features of an advanced object relational database like PostgreSQL directly is a major productivity and expressiveness boost but yes, manually mapping your rows to your DTOs and working with raw strings is major source of bugs. sqlx virtually solves this by:
Furthermore, there can be a lot of boilerplate queries we do that it's nice to not have to write, say, the same kind of delete query over and over. In the past I've used gnorm as one way of generating all that boilerplate code based on the actual database design, and it works reasonably well, but again it plays a similar role to an ORM.
Just as an addendum, the supabase.com team are bullish on the power and value of leaning heavily into the database. iirc, they're also the team behind postgREST which makes it easy to spin up a full REST API on the back of a PostgREST database. I used to think this kind of approach was a disaster, but I've changed my mind significantly. When being willing to use stored procedures, you can spin up this REST API, AND use the same stored procedures for your application as well, to ensure consistency of business logic, all without needing a separate business logic API middleware service between DB and the rest of the world. It's not all roses, but it is pretty amazing.
Just as an addendum, the supabase.com team are bullish on the power and value of leaning heavily into the database. iirc, they're also the team behind postgREST which makes it easy to spin up a full REST API on the back of a PostgREST database. I used to think this kind of approach was a disaster, but I've changed my mind significantly. When being willing to use stored procedures, you can spin up this REST API, AND use the same stored procedures for your application as well, to ensure consistency of business logic, all without needing a separate business logic API middleware service between DB and the rest of the world. It's not all roses, but it is pretty amazing.