Anything like sqlc for Rust?
I've been using Go's sqlc for a while now at work, for working with Postgres. Got to admit it's been great, better than any ORM or query builder I've used so far in any other language.
Recently I'm planning to write some Rust code that also uses Postgres, and I'm looking for something similar to sqlc (SQL-first code generator from files). From the libraries I looked at so far, they all seem to be code-first sql generators (typically in the form of macros).
Any ideas of a suitable alternative?
Edit: those suggesting sqlx are missing the point of sqlc. It’s not a library, rather a helper tool.
In sqlc you write your SQL schema and queries in .sql files, and then use the sqlc tool to compile SQL into Go code. It generates the models and query functions using your driver of choice (for example pgx, equivalent to Rust’s sqlx).
If sqlc had support for Rust, it would automatically generate the SQLx-based Rust code you need from the .sql files.
In short sqlc auto-generates application code from schema/query files.