Re:Choosing a Rust web framework
by xwdv on Sunday July 05, 2020 @02:00PM
(#23740543)
What’s a good PostgreSQL interface in Rust? Not looking for ORMs.
[ Parent
| on HN ]
Re:Choosing a Rust web framework
by Spartan-S63 on Sunday July 05, 2020 @02:11PM
(#23740629)
Diesel is going to be your most ORM-like option, which isn't what you're looking for. `tokio-postgres` is great for async connections.
SQLx is also a really good option, too, and has some ORM-like features (such as transforming SQL rows into a Rust struct via macros) while still allowing SQL to be a first-class citizen. SQLx is also async, so that would probably be the best one to look at first.
For a blocking interface, use https://docs.rs/postgres and for an async interface https://docs.rs/tokio-postgres
Also look at https://github.com/launchbadge/sqlx. I love compile-time checked queries (it's optional).
It's simple to use too, async and includes a pool.
There's rust-postgres, which is just a driver as you are looking for. It's not exactly what I'd call mature.
Diesel is more mature, but it is an ORM, albeit one with significantly less "magic", so maybe you'll like it more.