30 releases (17 breaking)

new 0.18.2 Dec 23, 2024
0.18.1 Aug 16, 2021
0.18.0 Dec 25, 2020
0.16.0 Dec 24, 2019
0.1.0 Nov 24, 2014

#646 in Database interfaces

Download history 2554/week @ 2024-09-07 2056/week @ 2024-09-14 2319/week @ 2024-09-21 2023/week @ 2024-09-28 1888/week @ 2024-10-05 2132/week @ 2024-10-12 2231/week @ 2024-10-19 2185/week @ 2024-10-26 2283/week @ 2024-11-02 2221/week @ 2024-11-09 1944/week @ 2024-11-16 3112/week @ 2024-11-23 2673/week @ 2024-11-30 2298/week @ 2024-12-07 2282/week @ 2024-12-14 1196/week @ 2024-12-21

9,247 downloads per month
Used in 51 crates (36 directly)

MIT license

5KB

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

lib.rs:

Postgres support for the r2d2 connection pool.

Dependencies

~7–16MB
~226K SLoC