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

#708 in Database interfaces

Download history 2056/week @ 2024-09-25 1754/week @ 2024-10-02 2071/week @ 2024-10-09 2060/week @ 2024-10-16 2280/week @ 2024-10-23 2466/week @ 2024-10-30 2360/week @ 2024-11-06 1938/week @ 2024-11-13 1805/week @ 2024-11-20 4000/week @ 2024-11-27 1927/week @ 2024-12-04 2521/week @ 2024-12-11 1862/week @ 2024-12-18 958/week @ 2024-12-25 1949/week @ 2025-01-01 2477/week @ 2025-01-08

7,655 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