Expand description
§async-duckdb
A library to interact with duckdb from an async context.
This library is tested on both tokio and async_std, however it should be compatible with all async runtimes.
§Usage
A Client
represents a single background duckdb connection that can be called
concurrently from any thread in your program.
To create a duckdb client and run a query:
use async_duckdb::{ClientBuilder};
let client = ClientBuilder::new()
.path("/path/to/db.duckdb")
.open()
.await?;
let value: String = client.conn(|conn| {
conn.query_row("SELECT val FROM testing WHERE id=?", [1], |row| row.get(0))
}).await?;
println!("Value is: {value}");
}
§Cargo Features
This library tries to export almost all features that the underlying duckdb library contains.
A notable difference is that the bundled
feature is enabled by default,
but can be disabled with the following line in your Cargo.toml:
async-duckdb = { version = "*", default-features = false }
Re-exports§
pub use duckdb;
Structs§
- Client
- Client represents a single duckdb connection that can be used from async contexts.
- Client
Builder - A
ClientBuilder
can be used to create aClient
with custom configuration. - Config
- duckdb configuration Refer to https://github.com/duckdb/duckdb/blob/master/src/main/config.cpp
- Connection
- A connection to a DuckDB database.
- Pool
- A simple Pool of duckdb connections.
- Pool
Builder - A
PoolBuilder
can be used to create aPool
with custom configuration.
Enums§
- Error
- Enum of all possible errors.