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

#627 in Database interfaces

Download history 2304/week @ 2024-10-22 2393/week @ 2024-10-29 2200/week @ 2024-11-05 2097/week @ 2024-11-12 1802/week @ 2024-11-19 3866/week @ 2024-11-26 2034/week @ 2024-12-03 2503/week @ 2024-12-10 1955/week @ 2024-12-17 1089/week @ 2024-12-24 1830/week @ 2024-12-31 2787/week @ 2025-01-07 2256/week @ 2025-01-14 2158/week @ 2025-01-21 1575/week @ 2025-01-28 2554/week @ 2025-02-04

8,797 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–18MB
~238K SLoC