Skip to content

Latest commit

 

History

History
122 lines (96 loc) · 3.52 KB

README.md

File metadata and controls

122 lines (96 loc) · 3.52 KB

libSQL Android

libSQL Android

Databases for Android multi-tenant AI Apps.

Turso · Docs · Quickstart · SDK Reference · Blog & Tutorials

MIT License Discord Contributors Total downloads Examples

Features

Warning

This SDK is currently in technical preview. Join us in Discord to report any issues.

Install

Add libsql to your Gradle dependencies:

dependencies {
    implementation("tech.turso.libsql:libsql:0.1.0")
}

Note

This will only work with the Android Gradle Plugin for now.

Quickstart

The example below uses Embedded Replicas and syncs data every 1000ms from Turso.

import tech.turso.libsql.Libsql

val db = Libsql.open(
    path = "./local.db",
    url = "TURSO_DATABASE_URL",,
    authToken = "TURSO_AUTH_TOKEN",
    syncInterval: 1000
)

val conn = db.connect()

db.connect().use {
    it.execute_batch("
      CREATE TABLE IF NOT EXISTS users (
          id INTEGER PRIMARY KEY AUTOINCREMENT,
          name TEXT
      );

      INSERT INTO users (name) VALUES ('Iku');
    ")
}

db.connect().use {
    it.query("SELECT * FROM users WHERE id = ?", 1)
}

Documentation

Visit our official documentation.

Support

Join us on Discord to get help using this SDK. Report security issues via email.

Contributors

See the contributing guide to learn how to get involved.

Contributors

good first issue