ruprizzle
A schema-first ORM for Rust: typed queries, relations, and automatic migrations.
ruprizzle is the runtime crate that you use in your application. Combine a declarative schema.ruprizzle file with the ruprizzle-cli code generator and you get a fully typed query builder, migrations, and relation include support for PostgreSQL, MySQL/MariaDB, and SQLite behind a single API. Optional native-driver feature flags (sqlite-rusqlite, postgres-tokio-postgres) and an optional metrics feature are also available.
Features
- Generated, type-safe clients — model structs, column tokens, and the
Dbroot are generated from your schema. - Drizzle-style query builder — chain
.filter,.select,.order,.include,.page, and more, and see the SQL. - Relations — one-to-one, one-to-many, and nested
includewith per-relation limits. - Migrations — diff your schema against the live database and generate
up.sql/down.sql. - Raw SQL, safely —
raw!macro for fragments that are bound, not interpolated. - Transactions — explicit
Tx::begin/commit/rollbackand isolation-level helpers. - Multi-backend — the same code runs on PostgreSQL, MySQL/MariaDB, and SQLite.
Example
use ;
use ;
let db = connect.await?;
let user = new
.set
.exec
.await?;
let users = new
.filter
.fetch_all
.await?;
For a full getting-started guide, see the project homepage.
Keywords
orm, sql, database, postgres, sqlite