pgorm 0.1.6

A lightweight Postgres-only ORM for Rust
Documentation

pgorm

A lightweight Postgres-only ORM for Rust.

Features

  • SQL explicit: SQL is a first-class citizen (use query() / sql(); qb::query() is an alias)
  • Type-safe mapping: Row → Struct via FromRow trait
  • Minimal magic: Traits and macros only for boilerplate reduction
  • Transaction-friendly: pass a transaction anywhere a GenericClient is expected
  • Query monitoring: Built-in support for timing, logging, and hooking SQL execution
  • SQL checking: Validate SQL against registered schemas and lint for common issues
  • Migrations: Optional SQL migrations via refinery (feature: migrate)

SQL fallback (qb)

The qb module is a thin wrapper around query() for running hand-written SQL:

use pgorm::qb;

let users: Vec<User> = qb::query("SELECT * FROM users WHERE status = $1")
    .bind("active")
    .fetch_all_as(&client)
    .await?;