chopin-pg
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 ;
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.
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(())
}