1 unstable release

Uses old Rust 2015

0.1.0 Aug 15, 2023

#5 in #duckdb

MIT license

4KB

r2d2-duckdb

r2d2 connection pool for duckdb.

Using DuckDB as the backend.


lib.rs:

DuckDb support for the r2d2 connection pool.

Library crate: r2d2-duckdb

Integrated with: r2d2

Example

extern crate r2d2;
extern crate r2d2_duckdb;
extern crate duckdb;

use std::thread;
use r2d2_duckdb::DuckDBConnectionManager;

fn main() {
    let manager = DuckDBConnectionManager::file("file.db");
    let pool = r2d2::Pool::builder().build(manager).unwrap();

    for i in 0..10i32 {
        let pool = pool.clone();
        thread::spawn(move || {
            let conn = pool.get().unwrap();
            let result = conn.execute("INSERT INTO foo (bar) VALUES (?)", duckdb::params![42]).unwrap();
        });
    }
}

Dependencies

~24–32MB
~389K SLoC