chopin-pg 0.5.9

A high-performance, asynchronous PostgreSQL driver for the Chopin framework.
Documentation

chopin-pg

Build status Crates.io Downloads License Rust

High-fidelity engineering for the modern virtuoso.

chopin-pg provides the high‑performance PostgreSQL driver used by the Chopin suite. It offers zero‑allocation query handling and per‑core connection pools.

🛠️ Usage Example

use chopin_pg::{PgConfig, PgConnection, PgValue};

fn main() -> PgResult<()> {
    let config = PgConfig::from_url("postgres://user:pass@localhost:5432/db")?;
    let mut conn = PgConnection::connect(&config)?;

    // Execute simple query
    let rows = conn.query_simple("SELECT current_database()")?;
    println!("Database: {}", rows[0].get(0)?);

    // Prepared statement (Extended Query Protocol)
    let rows = conn.query(
        "SELECT username FROM users WHERE id = $1",
        &[&42i32]
    )?;

    if let Some(row) = rows.first() {
        let name: String = row.get(0)?;
        println!("User: {}", name);
    }

    Ok(())
}