Docs.rs
  • async-sqlite-0.5.2
    • async-sqlite 0.5.2
    • Permalink
    • Docs.rs crate page
    • MIT
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • ryanfowler
    • Dependencies
      • crossbeam-channel ^0.5 normal
      • futures-channel ^0.3 normal
      • futures-util ^0.3 normal
      • rusqlite ^0.36.0 normal
      • async-std ^1.12.0 dev
      • paste ^1.0.12 dev
      • tempfile ^3.6.0 dev
      • tokio ^1.29.1 dev
    • Versions
    • 52.63% of the crate is documented
  • Platform
    • i686-unknown-linux-gnu
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate async_sqlite

async_sqlite0.5.2

  • All Items

Sections

  • async-sqlite
    • Usage
    • Cargo Features

Crate Items

  • Re-exports
  • Structs
  • Enums

Crates

  • async_sqlite

Crate async_sqlite

Source
Expand description

§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.

§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 async_sqlite::{ClientBuilder, JournalMode};

let client = ClientBuilder::new()
                .path("/path/to/db.sqlite3")
                .journal_mode(JournalMode::Wal)
                .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}");
}

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 async_sqlite::{JournalMode, PoolBuilder};

let pool = PoolBuilder::new()
              .path("/path/to/db.sqlite3")
              .journal_mode(JournalMode::Wal)
              .open()
              .await?;

let value: String = pool.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 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:

async-sqlite = { version = "*", default-features = false }

Re-exports§

pub use rusqlite;

Structs§

Client
Client represents a single sqlite connection that can be used from async contexts.
ClientBuilder
A ClientBuilder can be used to create a Client with custom configuration.
Pool
A simple Pool of sqlite connections.
PoolBuilder
A PoolBuilder can be used to create a Pool with custom configuration.

Enums§

Error
Enum of all possible errors.
JournalMode
The possible sqlite journal modes.

Results

Settings
Help
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.