Skip to content

Commit 899899e

Browse files
authored
feat: Add websockets strategy for Libsql access (#2)
* websockets working for reading & executions, batch & transactions wip * remove unused code * default to wss and fallback to http * fix interactive transactions over websocket * _ * check if running on globe and use globe strategy * add Readme.md file * _ * _ * _ * _ * _ * _ * _
1 parent 00e39be commit 899899e

File tree

12 files changed

+1119
-352
lines changed

12 files changed

+1119
-352
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.dart_tool
22
target
33
turso
4+
*.g.dart

Cargo.lock

Lines changed: 207 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ serde_json = "1.0.134"
1515
tokio = { version = "1.42.0", features = ["rt-multi-thread"] }
1616
reqwest = { version = "0.12.9", features = ["json", "blocking", "gzip"] }
1717
num_cpus = "1.17.0"
18+
tokio-tungstenite = { version = "0.27.0", features = ["native-tls"] }
19+
futures-util = "0.3.31"

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# libsqlite-turso
2+
3+
A rewrite for `libsqlite3.so` dynamic library that allows any SQLite client to seamlessly connect to [Turso](https://turso.tech/) or LibSQL databases — with zero client-side changes.
4+
5+
This project provides drop-in `libsqlite3.so` support with automatic strategy selection depending on runtime context.
6+
7+
## ✨ Features
8+
9+
- ✅ Works with **any SQLite client** that uses `libsqlite3.so`
10+
- 🔁 Supports both `Http` & `Websocket` protocol for LibSQL
11+
- 🔌 No custom SQLite client logic or [Hrana](https://github.com/tursodatabase/libsql/blob/main/docs/HRANA_3_SPEC.md) knowledge required
12+
13+
---
14+
15+
## 🔧 Setup
16+
17+
### 1. Build the custom `libsqlite3.so`
18+
19+
```bash
20+
cargo build --release
21+
```
22+
23+
### 2. Place `libsqlite3.so` in your system
24+
25+
This project assumes `libsqlite3.so` is available at runtime.
26+
27+
Place it in a standard library path (e.g., `/usr/lib`, or use `/usr/local/lib/`).
28+
29+
---
30+
31+
## 🚀 Usage
32+
33+
Use **any standard SQLite library** in your language/runtime — this project handles the dynamic strategy and connection logic under the hood.

src/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{future::Future, pin::Pin};
22

3-
use crate::utils::TursoConfig;
3+
use crate::transport::TursoConfig;
44

55
pub trait DbAuthStrategy {
66
fn resolve<'a>(

0 commit comments

Comments
 (0)