Crate r2d2_duckdb

source ·
Expand description

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

Structs