Crate rqlite_rs

source
Expand description

An async rqlite client for Rust.

Have a look at the README to get started or browse the examples.

The simplest way to get started is importing the prelude and creating a client via the RqliteClientBuilder:

use rqlite_rs::prelude::*;

#[derive(FromRow)]
pub struct Table {
    name: String,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = RqliteClientBuilder::new()
        .known_host("localhost:4001")
        .build()?;

    let query = rqlite_rs::query!(
        "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'"
    )?;

    let rows = client.fetch(query).await?;

    let tables = rows.into_typed::<Table>()?;

    for table in tables {
        println!("Table: {}", table.name);
    }

    Ok(())
}

This will print all tables in the rqlite database.

Re-exports§

Modules§

Macros§

  • A macro for creating a query. Returns a Result with an RqliteQuery if the query is valid. The macro accepts a query string and optional arguments.

Structs§

Enums§

Traits§

Derive Macros§