Skip to main content

Crate diesel_libsql

Crate diesel_libsql 

Source
Expand description

A Diesel backend for libSQL (Turso’s SQLite-compatible database).

This crate lets you use Diesel’s typed query builder, migrations, and connection traits against local SQLite files, remote Turso databases, and embedded replicas – all through a single LibSqlConnection type.

§Why not diesel::sqlite?

§Quick start

use diesel::prelude::*;
use diesel_libsql::LibSqlConnection;

let mut conn = LibSqlConnection::establish(":memory:")
    .expect("Failed to connect");

diesel::sql_query("CREATE TABLE demo (id INTEGER PRIMARY KEY, val TEXT)")
    .execute(&mut conn)
    .unwrap();

§Feature flags

FlagDescription
r2d2Sync connection pooling via r2d2
asyncNative async connection via diesel-async
deadpoolAsync connection pooling via deadpool (implies async)
bb8Async connection pooling via bb8 (implies async)
otelOtelInstrumentation for OpenTelemetry spans
encryptionAES-256 encryption at rest via establish_encrypted (requires cmake)

Structs§

LibSql
The LibSql backend type for Diesel.
LibSqlBindCollector
Bind parameter collector for LibSql queries.
LibSqlBindValue
A bind value for LibSql statements.
LibSqlConnection
A Diesel connection backed by libsql.
ReplicaBuilder
Builder for embedded replica connections with advanced configuration.

Enums§

LibSqlValue
An eagerly-extracted, owned value from a libsql row.