async_duckdb/
lib.rs

1//! # async-duckdb
2//!
3//! A library to interact with duckdb from an async context.
4//!
5//! This library is tested on both [tokio](https://docs.rs/tokio/latest/tokio/)
6//! and [async_std](https://docs.rs/async-std/latest/async_std/), however
7//! it should be compatible with all async runtimes.
8//!
9//! ## Usage
10//!
11//! A `Client` represents a single background duckdb connection that can be called
12//! concurrently from any thread in your program.
13//!
14//! To create a duckdb client and run a query:
15//!
16//! ```rust
17//! use async_duckdb::{ClientBuilder};
18//!
19//! # async fn run() -> Result<(), async_duckdb::Error> {
20//! let client = ClientBuilder::new()
21//!                 .path("/path/to/db.duckdb")
22//!                 .open()
23//!                 .await?;
24//!
25//! let value: String = client.conn(|conn| {
26//!     conn.query_row("SELECT val FROM testing WHERE id=?", [1], |row| row.get(0))
27//! }).await?;
28//!
29//! println!("Value is: {value}");
30//! # Ok(())
31//! }
32//! ```
33//!
34//! ## Cargo Features
35//!
36//! This library tries to export almost all features that the underlying
37//! [duckdb](https://docs.rs/duckdb/latest/duckdb/) library contains.
38//!
39//! A notable difference is that the `bundled` feature is **enabled** by default,
40//! but can be disabled with the following line in your Cargo.toml:
41//!
42//! ```toml
43//! async-duckdb = { version = "*", default-features = false }
44//! ```
45
46pub use duckdb;
47pub use duckdb::{Config, Connection};
48
49mod client;
50mod error;
51mod pool;
52
53pub use client::{Client, ClientBuilder};
54pub use error::Error;
55pub use pool::{Pool, PoolBuilder};