30 releases (17 breaking)

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

#650 in Database interfaces

Download history 1828/week @ 2024-11-15 2635/week @ 2024-11-22 3202/week @ 2024-11-29 2234/week @ 2024-12-06 2310/week @ 2024-12-13 1383/week @ 2024-12-20 1337/week @ 2024-12-27 2514/week @ 2025-01-03 2538/week @ 2025-01-10 2041/week @ 2025-01-17 1781/week @ 2025-01-24 2098/week @ 2025-01-31 3052/week @ 2025-02-07 2413/week @ 2025-02-14 2333/week @ 2025-02-21 1900/week @ 2025-02-28

10,213 downloads per month
Used in 50 crates (35 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

~8–17MB
~245K SLoC