Connectors
LibSQL
Connect DB0 to LibSQL
Usage
For this connector, you need to install @libsql/client
dependency:
npm i @libsql/client
Choose on of the libsql
, libsql/http
or libsql/web
connectors depending on your usage requirements:
import { createDatabase } from "db0";
import libSql from "db0/connectors/libsql";
const db = createDatabase(libSql({ url: `file:local.db` }));
Options
url
Type: string
The database URL. The client supports libsql:
, http:
/https:
, ws:
/wss:
and file:
URL. For more information, please refer to the project README: link
authToken
Type: string
(optional)
Authentication token for the database.
tls
Type: boolean
(optional)
Enables or disables TLS for libsql:
URLs. By default, libsql:
URLs use TLS. You can set this option to false
to disable TLS.
intMode
Type: IntMode
(optional)
How to convert SQLite integers to JavaScript values:
"number"
(default): returns SQLite integers as JavaScriptnumber
-s (double precision floats).number
cannot precisely represent integers larger than 2^53-1 in absolute value, so attempting to read larger integers will throw aRangeError
."bigint"
: returns SQLite integers as JavaScriptbigint
-s (arbitrary precision integers). Bigints can precisely represent all SQLite integers."string"
: returns SQLite integers as strings.