Files
trailbase/trailbase-sqlite/examples/uuid.rs
T
Sebastian Jeltsch e0ad4a898c Extend trailbase-sqlites execution model to allow for parallel reads. This reduces the latency long-tail for slow reads.
Note that this complicates the APIs, since it pushes the responsibility
of declaring a query a read or write to the user to then be scheduled
appropriately.

Add `.(read_|)query_row_f` APIs similar to rusqlites
`conn.query_row` accepting a `|row| -> Result<T>` to reduce the use of
`Row` and `Rows`.

Make benchmarks more isolated by not sharing a DB across runs
accumulating writes.
2025-04-15 12:15:40 +02:00

17 lines
517 B
Rust

/// This is a very simple binary demonstrating how TrailBase's SQLite extensions (e.g. uuid_v7)
/// can be used outside of TrailBase, thus avoiding lock-in.
use trailbase_extension::connect_sqlite;
use trailbase_sqlite::Connection;
#[tokio::main]
async fn main() {
let conn = Connection::new(|| connect_sqlite(None, None), None).expect("in memory connection");
let uuid: Option<String> = conn
.read_query_value("SELECT (uuid_text(uuid_v7()))", ())
.await
.unwrap();
println!("Done! {uuid:?}");
}