Expand description
Turso / libSQL adapter for the ruprizzle ORM.
TursoPool implements ruprizzle::Executor by sending each statement to a
libSQL server over the Hrana 2 HTTP protocol — POST {url}/v2/pipeline
with the SQL and its bound parameters, and one result set back. It works against
Turso’s hosted databases and against any sqld you run yourself.
§What this adapter does and does not do
Every statement is one HTTP request. There is no server-side session, so there is
no interactive transaction: BEGIN and COMMIT sent as separate statements would
land on unrelated connections and are not supported. Batch the work into a single
statement, or use a SQLite file through ruprizzle::connect when you need
multi-statement transactions.
Embedded replicas — a local SQLite file kept in sync with a remote primary — need
the native libSQL library and are out of scope here. If you already have a replica
file, point ruprizzle::connect at it as an ordinary SQLite database.
§Example
use ruprizzle::Executor;
use ruprizzle::value::Value;
use ruprizzle_turso::TursoPool;
let pool = TursoPool::builder()
.url("libsql://your-db.turso.io")
.auth_token(std::env::var("TURSO_AUTH_TOKEN")?)
.build()?;
let rows = pool
.fetch_all_raw("SELECT id, email FROM users WHERE id = ?".into(), vec![Value::I64(7)])
.await?;Structs§
- Turso
Pool - A handle to a libSQL database over Hrana HTTP.
- Turso
Pool Builder - Builder for
TursoPool.
Enums§
- Turso
Error - Errors raised by the Turso adapter.