SqliteStatementinterfaceno test imports itinterface SqliteStatementA prepared statement of node:sqlite or bun:sqlite.
| Member | Type | What it is |
|---|---|---|
all | (...params: unknown[]) => unknown[] | |
run | (...params: unknown[]) => unknown |
The port of a SQLite database: a connection of node:sqlite or of bun:sqlite (typed by the shape both have, so that this library depends on neither), or a file opened by the runtime that is running. A write is BEGIN IMMEDIATE, so that a second writer waits (the busy timeout) and never fails halfway; a file is opened in write-ahead mode, so that readers do not stop the writer. Two connections to one file in one process share a gate, since a connection that waits for the lock of another in the same thread would never get it.
import { openSqliteFile } from "@intellectual-frontiers/anyfs-sql/sqlite";
const port = await openSqliteFile("fleet.db");SqliteStatementinterfaceno test imports itinterface SqliteStatementA prepared statement of node:sqlite or bun:sqlite.
| Member | Type | What it is |
|---|---|---|
all | (...params: unknown[]) => unknown[] | |
run | (...params: unknown[]) => unknown |
SqliteDatabaseinterfaceno test imports itinterface SqliteDatabaseA connection of node:sqlite (DatabaseSync) or bun:sqlite (Database).
| Member | Type | What it is |
|---|---|---|
exec | (sql: string) => unknown | |
prepare | (sql: string) => SqliteStatement | |
close | () => unknown |
SqliteOptionstypeno test imports ittype SqliteOptions = {
/** The gate that serializes this connection with others to the same file in this process: made for the connection where not given. */
readonly gate?: Gate;
/** How long a writer waits for the lock of another process, in milliseconds (5000 where not given). */
readonly busyMs?: number;
};What a SQLite port may be given.
sqlitePortfunctionno test imports itfunction sqlitePort(db: SqliteDatabase, options?: SqliteOptions): SqlPortThe port of a connection of SQLite.
openSqliteFilefunctionfunction openSqliteFile(file: string, options?: SqliteOptions): Promise<Result<SqlPort, string>>Opens a SQLite file (or :memory:) with the module of the runtime that is running: bun:sqlite in Bun and node:sqlite in Node.
fingerprintOfFilefunctionno test imports itfunction fingerprintOfFile(file: string): Promise<string>What tells a copy of a database file from the original: the device and the file of the file system object (dev:ino), which cp does not keep and a rename does. A database opened with a fingerprint other than the one it holds is a copy and takes a new replica identity. memory for a database in memory; where the file system has no file number, the resolved name.