fn0-doc-db 0.4.16

Document-oriented Turso/libSQL DB (works in both WASI components and native binaries)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod database;
mod transaction;

const UPSERT_DOC_SQL: &str = "INSERT INTO docs (pk, sk, data, version) VALUES (?, ?, ?, 0) ON CONFLICT(pk, sk) DO UPDATE SET data = excluded.data, version = docs.version + 1";

#[derive(Clone)]
pub(crate) struct TursoDatabase {
    http_url: String,
    auth_token: String,
}

pub(crate) struct TursoTransaction {
    db: TursoDatabase,
    baton: Option<String>,
}