No description or website provided.
Rust
Latest commit 3c3279a Nov 10, 2016 @sfackler Release v0.11.1
Permalink
Failed to load latest commit information.
src Release v0.11.1 Nov 10, 2016
tests Update to postgres 0.12 Oct 11, 2016
.gitignore Add PostgresPoolManager Aug 6, 2014
.travis.yml Update to postgres 0.12 Oct 11, 2016
Cargo.toml Release v0.11.1 Nov 10, 2016
LICENSE Initial commit Aug 6, 2014
README.md Release v0.11.0 Oct 11, 2016

README.md

r2d2-postgres

Build Status

Documentation

rust-postgres support library for the r2d2 connection pool.

Example

extern crate r2d2;
extern crate r2d2_postgres;
extern crate postgres;

use std::thread;
use r2d2_postgres::{TlsMode, PostgresConnectionManager};

fn main() {
    let config = r2d2::Config::default();
    let manager = PostgresConnectionManager::new("postgres://postgres@localhost",
                                                 TlsMode::None).unwrap();
    let pool = r2d2::Pool::new(config, manager).unwrap();

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