Expand description
Β§Premix ORM π
βWrite Rust, Run Optimized SQL.β
Premix is a Zero-Overhead, Type-Safe ORM for Rust that eliminates the need for manual migration files. It combines the ease of use of Active Record with the raw performance of handcrafted SQL.
Β§π Key Features
- πͺ Auto-Sync Schema: Syncs your Rust structs directly to the database.
- β‘ Zero Overhead: Uses macros to generate SQL at compile-time.
- π Application-Level Joins: Solves N+1 problems with smart
WHERE INqueries. - π Multi-Database: Support for SQLite, Postgres, and MySQL.
Β§π Quick Start
use premix_orm::prelude::*;
use serde::{Serialize, Deserialize};
#[derive(Model, Debug, Serialize, Deserialize)]
struct User {
id: i32,
name: String,
}
// Connect and Sync
let pool = premix_orm::sqlx::SqlitePool::connect("sqlite::memory:").await?;
premix_orm::Premix::sync::<premix_orm::sqlx::Sqlite, User>(&pool).await?;
// Create
let mut user = User { id: 0, name: "Alice".to_string() };
user.save(&pool).await?;Β§π¦ Installation
[dependencies]
premix-orm = "1.0.2"ModulesΒ§
- async_
trait - githubβcrates-ioβdocs-rs
- migrator
- prelude
- sqlx
- The async SQL toolkit for Rust, built with β€οΈ by the LaunchBadge team.