Files
trailbase/trailbase-sqlite/examples/uuid.rs
Sebastian Jeltsch 6cbea390fb Herculean migration from libsql's rust bindings to plain rusqlite+SQLite.
There's a couple of reasons:

* As for the rust bindings: they're sub-par to rusqlite, though
  rusqlite is amazing. Even libsql-server uses rusqlite over their own
  bindings. The bindings are missing features such as update hooks
  and the hard-coded execution model suffers from lock congestion.
* We've fixed bugs (e.g. trivial null ptr accesses went unnoticed),
  raised issues, and tried to add missing functionality such as update
  hooks. It's unclear if the rust-bindings are a priority or covered by
  the principles laid out in the libsql manifesto. From the outside it
  looks like focus has shifted to https://github.com/penberg/limbo.
* As for the C-libsql fork for SQLite itself, it's getting more and
  more outdated (2024-01-30 (3.45.1)) and it's unclear when and if the
  ideas from the manifesto will manifest.

Looking forward this opens the door for TrailBase to:

* Bundle more recent versions of SQLite
* Implement more performant, better scaling execution models.
* Implement realtime APIs for subscribing to data changes.
2024-12-04 13:03:06 +01:00

14 lines
428 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_sqlite::connect_sqlite;
fn main() {
let conn = connect_sqlite(None, None).unwrap();
let mut stmt = conn.prepare("SELECT (uuid_v7_text())").unwrap();
let uuid: String = stmt.query_row((), |row| row.get(0)).unwrap();
println!("Done! {uuid:?}");
}