2024-11-29 12:35:55 +00:00
|
|
|
/// 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.
|
2025-04-08 10:25:10 +00:00
|
|
|
use trailbase_extension::connect_sqlite;
|
|
|
|
|
use trailbase_sqlite::Connection;
|
2024-10-30 22:38:29 +00:00
|
|
|
|
2025-04-08 10:25:10 +00:00
|
|
|
#[tokio::main]
|
|
|
|
|
async fn main() {
|
|
|
|
|
let conn = Connection::new(|| connect_sqlite(None, None), None).expect("in memory connection");
|
2024-10-30 22:38:29 +00:00
|
|
|
|
2025-04-08 10:25:10 +00:00
|
|
|
let uuid: Option<String> = conn
|
2025-04-08 14:56:19 +00:00
|
|
|
.read_query_value("SELECT (uuid_text(uuid_v7()))", ())
|
2025-04-08 10:25:10 +00:00
|
|
|
.await
|
|
|
|
|
.unwrap();
|
2024-10-30 22:38:29 +00:00
|
|
|
|
|
|
|
|
println!("Done! {uuid:?}");
|
|
|
|
|
}
|