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§
pub use client::RqliteClient;
pub use client::RqliteClientBuilder;
Modules§
Macros§
- A macro for creating a query. Returns a
Result
with anRqliteQuery
if the query is valid. The macro accepts a query string and optional arguments.