For AI agents: the complete documentation index is available at https://a3s-lab.github.io/ORM/v0.3.0/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/ORM/v0.3.0/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/ORM/v0.3.0/en/index.md.
  • English
  • v0.3.0
  • Typed queries.SQL stays visible.

    Compose with Rust types, compile parameterized SQL, then run it on async SQLite or PostgreSQL.

    Typed query
    update_table::<Job>()
      .set(Job::state(), "leased")
      .filter(Job::id().eq(42))
      .returning(Job::id())
    Compiled result
    update "jobs"
    set "state" = $1
    where "jobs"."id" = $2
    returning "jobs"."id"
    Bound parameters[String("leased"), I64(42)]

    Choose a runtime. Copy one dependency.

    SQLite is enabled by default. Select PostgreSQL or use the compiler alone.

    a3s-orm = { git = "https://github.com/A3S-Lab/ORM", tag = "v0.3.0" }

    Types constrain structure. Execution stays explicit.

    Each layer owns one stable contract, from table declarations through decoded results.

    orm_table!

    Typed structure

    Tables, columns, values, assignments, and result shapes agree at compile time.

    Query

    Immutable query AST

    Joins, CTEs, windows, set operations, and locks remain structured nodes.

    Executor

    Executor neutral

    Compilers emit SQL and parameters. Async drivers own connections and rows.

    Migrator

    Deterministic migrations

    Ordered versions, SHA-256 checksums, and database locks protect history.

    A query moves in one direction.

    No implicit persistence behavior. No runtime value enters SQL text.

    1. 01

      Tables and expressions

      Rust types define legal composition

    2. 02

      Query AST

      Semantics and parameter boundaries stay intact

    3. 03

      Dialect compiler

      Owns quoting, placeholders, and capability checks

    4. 04

      Async executor

      Owns connections, transactions, and decoding

    One query contract. Two production runtimes.

    SQLite

    A Tokio-safe single connection with WAL, foreign keys, and cancellation-safe transactions.

    • Default feature
    • Nested savepoints
    • BEGIN IMMEDIATE migration lock

    PostgreSQL

    A bounded pool with prepared statements, rustls, health snapshots, and explicit retry classes.

    • Deadpool connection pool
    • Transaction policy and advisory locks
    • Atomic TLS pool rotation
    Compare drivers and dialects

    Production boundaries live in docs and error paths.

    Read production readiness
    • Unsupported dialect syntax fails during compilation.
    • Migrations are forward-only and verify applied history.
    • SQLite serializes one connection. PostgreSQL uses a bounded pool.
    • MySQL currently compiles SQL without a bundled runtime.

    Start with one inspectable query.

    Declare a table, compile its SQL, then connect the async runtime you need.

    Get started