Crate premix_orm

Crate premix_orm 

Source
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 IN queries.
  • 🌍 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.

StructsΒ§

Migration
Migrator
Premix
QueryBuilder
ValidationError

EnumsΒ§

Executor
UpdateResult

TraitsΒ§

IntoExecutor
Model
ModelHooks
ModelValidation
SqlDialect

Derive MacrosΒ§

Model