mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
The serverless driver's main entry point is meant to mirror the native
@tursodatabase/database surface, which has no execute() — it exposes
prepare/run/get/all/iterate/exec/batch/pragma/transaction. Connection.execute()
was a libsql-client-ism on that surface, and it returned the raw protocol
result shape rather than the {changes, lastInsertRowid} / row-array contracts
the sibling methods use.
The libsql compatibility layer keeps its own execute(), which talks to
Session.execute() directly and never went through Connection.execute(), so the
compat surface is unaffected.
Tests: rewrote the serverless integration tests and the serverless-only
conformance tests against exec/run/get/all; tsc and the package build pass.
Both suites need a live TURSO_DATABASE_URL and were not run.
Cloud Encryption Example
This smoll example shows how to connect to an encrypted Turso Cloud database.
Prerequisites
You need a Turso Cloud database with encryption enabled. Refer to the documentation here for instructions.
Running
npm i
export TURSO_DATABASE_URL="libsql://your-db.turso.io"
export TURSO_AUTH_TOKEN="your-auth-token"
export TURSO_REMOTE_ENCRYPTION_KEY="base64-encoded-key"
node index.mjs