3 releases

0.1.2 Jul 16, 2021
0.1.1 Jul 14, 2021
0.1.0 Jul 14, 2021

#590 in Database interfaces

MIT/Apache

67KB
975 lines

Deadpool for Diesel Latest Version

Deadpool is a dead simple async pool for connections and objects of any type.

This crate implements a deadpool manager for diesel connections.

Features

Feature Description Extra dependencies Default
sqlite Enable sqlite feature in diesel crate diesel/sqlite no
postgres Enable postgres feature in diesel crate diesel/postgres no
mysql Enable mysql feature in diesel crate diesel/mysql no
rt_tokio_1 Enable support for tokio crate deadpool/rt_tokio_1 yes
rt_async-std_1 Enable support for async-std crate deadpool/rt_async-std_1 no

Example

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let manager = deadpool_diesel::sqlite::Manager::new(":memory:");
    let pool = deadpool_diesel::sqlite::Pool::new(manager, 8);
    let conn = pool.get().await?;
    // TODO use the connection with diesel
    Ok(())
}

License

Licensed under either of

at your option.

Dependencies

~3.5–7MB
~140K SLoC