async-sqlite
A library to interact with sqlite from an async context.
This library is tested on both tokio and async_std, however it should be compatible with all async runtimes.
Install
Add async-sqlite
to your "dependencies" in your Cargo.toml file.
This can be done by running the command:
cargo add async-sqlite
Usage
A Client
represents a single background sqlite3 connection that can be called
concurrently from any thread in your program.
To create a sqlite client and run a query:
use ;
let client = new
.path
.journal_mode
.open
.await?;
let value: String = client.conn.await?;
println!;
A Pool
represents a collection of background sqlite3 connections that can be
called concurrently from any thread in your program.
To create a sqlite pool and run a query:
use ;
let pool = new
.path
.journal_mode
.open
.await?;
let value: String = pool.conn.await?;
println!;
Cargo Features
This library tries to export almost all features that the underlying rusqlite 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:
= { = "*", = false }