IF Commons GitHub

physical/adapters/libsql

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-sql-port FR-006

The port of a libSQL client, which is how Turso (and a libSQL file, and a server of sqld) is reached. It is typed by the shape of the client's execute and transaction, so that this library depends on no client: the client a caller already has is the port. The dialect is SQLite's; the layout, the statements and the revisions are the same as for a file.

import { libsqlPort } from "@intellectual-frontiers/anyfs-sql/libsql";
// const client = createClient({ url: "libsql://fleet-example.turso.io", authToken });
// const port = libsqlPort(client);

Source: commons/anyfs-sql/src/physical/adapters/libsql.ts

0 of 5 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

LibsqlResultinterfaceno test imports it
interface LibsqlResult

What execute gives.

MemberTypeWhat it is
rowsreadonly unknown[]
LibsqlExecutorinterfaceno test imports it
interface LibsqlExecutor

What runs one statement: a client, or a transaction of one.

MemberTypeWhat it is
execute(statement: { readonly sql: string; readonly args: readonly SqlValue[]; }) => Promise<LibsqlResult>
LibsqlTransactioninterfaceno test imports it
interface LibsqlTransaction extends LibsqlExecutor

A transaction of a libSQL client.

MemberTypeWhat it is
commit() => Promise<void>
rollback() => Promise<void>
close() => void
execute(statement: { readonly sql: string; readonly args: readonly SqlValue[]; }) => Promise<LibsqlResult>
LibsqlClientinterfaceno test imports it
interface LibsqlClient extends LibsqlExecutor

A libSQL client.

MemberTypeWhat it is
transaction(mode?: "deferred" | "read" | "write" | undefined) => Promise<LibsqlTransaction>
close() => void
execute(statement: { readonly sql: string; readonly args: readonly SqlValue[]; }) => Promise<LibsqlResult>
libsqlPortfunctionno test imports it
function libsqlPort(client: LibsqlClient): SqlPort

The port of a libSQL client.

Titles, headings, exports, tables, columns and requirements. Esc closes.