4 ms·
Related to web frameworks, what is the current status on ORM in the Rust ecosystem?
by raphaelj 7y ago
Related to web frameworks, what is the current status on ORM in the Rust ecosystem?
- bluejekyll 7y agoI think this is still the state-of-the-art in Rust: https://diesel.rs/ https://diesel.rs/
- the_duke 7y agoThere is only one option: diesel [1]. It is a powerful solution for correctness, as it is completely type-safe. It's also really fast since a lot of work is delegated to compile time. There are also plenty of drawbacks though: the extensive type system hacking can lead to very confusing compiler errors, it doesn't work well when you need to sometimes fall back to more dynamic db handling, and it doesn't handle large tables well. (very long compile times etc), and the documentation is quite sparse. It's a robust solution for greenfield projects where you can design the schema partially with diesel in mind, but I wouldn't recommend it for existing DBs or projects that you know will grow large (eg 100+ column tables etc). [1] https://github.com/diesel-rs/diesel https://github.com/diesel-rs/diesel
- inferiorhuman 7y agoit doesn't handle large tables well. (very long compile times etc) By large tables you mean a large number of columns, not a large number of rows, right?
- hobofan 7y agoThe main ORM in the ecosystem is Diesel[0], which is very usable, though it can be a bit hard to get into due to lack of documentation/tutorials (compared to what people are used to from other ORMs). It has to be said though, that compared to other ecosystems, less focus is put on ORMs, and more focus is put on the specific database crates (e.g. rust-postgres), and how to make them easy to use without ORMs. [0]: https://diesel.rs https://diesel.rs
- aitchnyu 7y agoIs there an unsafe SQL generator for Rust? Pardon my not knowing Rust syntax: q = select("table") q = q.where_greater_than("col", 5) if(x) { q = q.where_equal("col2", true) }