1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! A [Diesel](https://diesel.rs) backend for [libSQL](https://turso.tech/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`?
//!
//! - **ALTER COLUMN**: libSQL extends SQLite with `ALTER TABLE ... ALTER COLUMN`,
//! exposed here via [`LibSqlConnection::alter_column`].
//! - **Remote Turso**: connect to `libsql://` URLs with auth tokens.
//! - **Embedded replicas**: local reads with remote sync via
//! [`LibSqlConnection::establish_replica`].
//!
//! # Quick start
//!
//! ```rust,no_run
//! 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
//!
//! | Flag | Description |
//! |--------------|----------------------------------------------------|
//! | `r2d2` | Sync connection pooling via `r2d2` |
//! | `async` | Native async connection via `diesel-async` |
//! | `deadpool` | Async connection pooling via `deadpool` (implies `async`) |
//! | `bb8` | Async connection pooling via `bb8` (implies `async`) |
//! | `otel` | `OtelInstrumentation` for OpenTelemetry spans |
//! | `encryption` | AES-256 encryption at rest via `establish_encrypted` (requires `cmake`) |
/// Sync connection pooling via `r2d2`. Requires the `r2d2` feature.
/// Async connection pooling via `deadpool`. Requires the `deadpool` feature.
/// Async connection pooling via `bb8`. Requires the `bb8` feature.
pub use LibSql;
pub use ;
pub use ;
pub use LibSqlValue;
pub use ;
pub use OtelInstrumentation;