#orm #async #postgresql

prax-postgres

PostgreSQL driver for the Prax ORM with connection pooling

22 releases (7 breaking)

Uses new Rust 2024

0.10.0 May 26, 2026
0.9.5 Apr 30, 2026
0.6.3 Mar 22, 2026
0.4.0 Dec 29, 2025

#3 in #postgresql


Used in 5 crates

MIT/Apache

2.5MB
55K SLoC

prax-postgres

PostgreSQL driver for the Prax ORM with connection pooling and prepared statement caching.

This crate provides:

  • Connection pool management using deadpool-postgres
  • Prepared statement caching for improved performance
  • Type-safe parameter binding
  • Row deserialization into Prax models

Example

use prax_postgres::PgPool;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a connection pool
    let pool = PgPool::builder()
        .url("postgresql://user:pass@localhost/db")
        .max_connections(10)
        .build()
        .await?;

    // Get a connection
    let conn = pool.get().await?;

    Ok(())
}

prax-postgres

PostgreSQL query engine for Prax ORM.

Overview

prax-postgres provides an async PostgreSQL backend using tokio-postgres with deadpool-postgres connection pooling.

Features

  • Async query execution with Tokio
  • Connection pooling via deadpool-postgres
  • Transaction support with savepoints
  • Prepared statement caching
  • SSL/TLS support

Usage

use prax_postgres::PostgresEngine;

let engine = PostgresEngine::new("postgresql://user:pass@localhost/db").await?;

// Execute queries through Prax client
let client = PraxClient::with_engine(engine);
let users = client.user().find_many().exec().await?;

Configuration

use prax_query::connection::PoolConfig;

let config = PoolConfig::new()
    .max_connections(20)
    .min_connections(5)
    .idle_timeout(Duration::from_secs(300));

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Dependencies

~15–23MB
~337K SLoC