8 ms·
I am really happy to see some more exploration in the typesafe-db-access-in-Rust space. > The existing libraries don't provide the compile time guarantees that
by davidatbu 2y ago
I am really happy to see some more exploration in the typesafe-db-access-in-Rust space.
> The existing libraries don't provide the compile time guarantees that I want and are verbose or awkward like SQL.
Worth noting: diesel definitely fulfills the "providing compile time guarantees" criteria.
Here's where I stand on the inevitable ORM-vs-no-ORM debate that's about to erupt: I like typesafe query builders that don't abstract over sql ( I'd put diesel in this category, and i would not put activerecord or djangos orm or sealORM in this category).
It looks like rust-query will lean towards the full-ORM side of that spectrum. Not my cup of tea, but the tea industry can accommodate many flavors :)
- pdimitar 2y ago> Worth noting: diesel definitely fulfills the "providing compile time guarantees" criteria. Also sqlx. I liked the article and I bookmarked the library but this statement from the author confused me a bit. At least two libraries give you pretty good compile-time guarantees. sqlx even gives you the option to specify a DB where it can check whether your queries will succeed at runtime.
- weiznich 2y ago> Also sqlx. The guarantees provides by sqlx are less strong than what's provided by diesel due to the fact that sqlx needs to know the complete query statically at compile time. This excludes dynamic constructs like `IN` expressions or dynamic where clauses from the set of checked queries. Diesel also verifies that these queries are correct at compile time.
- Kinrany 2y agoAgree. SQL libraries should aim to make any valid query possible to express (though semantic equivalents are fine) while integrating query building into the rest of the language as seamlessly as possible.