r2d2_postgres

Crates.ior2d2_postgres
lib.rsr2d2_postgres
version0.18.1
sourcesrc
created_at2014-11-24 02:37:43.83886
updated_at2021-08-16 14:52:31.059889
descriptionPostgres support for the r2d2 connection pool
homepage
repositoryhttps://github.com/sfackler/r2d2-postgres
max_upload_size
id383
size6,340
cargo publish (github:servo:cargo-publish)

documentation

README

r2d2-postgres

CircleCI

Documentation

rust-postgres support library for the r2d2 connection pool.

Example

use std::thread;
use r2d2_postgres::{postgres::NoTls, PostgresConnectionManager};

fn main() {
    let manager = PostgresConnectionManager::new(
        "host=localhost user=postgres".parse().unwrap(),
        NoTls,
    );
    let pool = r2d2::Pool::new(manager).unwrap();

    for i in 0..10i32 {
        let pool = pool.clone();
        thread::spawn(move || {
            let mut client = pool.get().unwrap();
            client.execute("INSERT INTO foo (bar) VALUES ($1)", &[&i]).unwrap();
        });
    }
}
Commit count: 140

cargo fmt