Docs

API: types

Interfaces and type aliases used by methods. Names match the generated TypeScript definitions in src/definitions.ts.

Result types

SqliteResult<T>

type SqliteResult<T> = SqliteSuccess<T> | SqliteFailure;

Every plugin method resolves to this — never rejects. See Concepts.

SqliteSuccess<T>

Prop Type
success true
data T

SqliteFailure

Prop Type
success false
error SqliteError

SqliteError

Prop Type Description
code SqliteErrorCode See Error codes.
message string
platform SqlitePlatform
method string Name of the plugin method that failed.
details Record<string, unknown> All implementations include nativeCode, nativeMessage, and source. Treat additional keys as platform-specific debugging hints, not a stable contract.

Options types

OpenOptions

Prop Type Description
database string Database file name (without extension). iOS/Electron match this case-insensitively against already-open handles.
readonly boolean When true, write operations return a failure. Reopening with a different readonly value than the original open returns DB_ALREADY_OPEN.
directory SqliteDirectory Logical storage location — see Platform notes. ':memory:' databases ignore this option.
migrations Migration[] See Migrations.

Migration

Prop Type Description
version number Target schema version. Must be unique within one open() call, 1..2147483647. Runs ascending.
statements string[] SQL statements for this version. Each string must be exactly one statement.

ExecuteOptions

Prop Type Description
database string
statements string[] Non-empty array; empty array returns INVALID_PARAMS. One statement per string.
transaction boolean Wrap all statements in one transaction. Default true.

RunOptions

Prop Type Description
database string
statement string Single parameterized statement.
values SQLiteValues Positional values for anonymous ? placeholders, in order. Count must exactly match the placeholder count.

RunBatchOptions

Prop Type Description
database string
set { statement: string; values?: SQLiteValues }[]
transaction boolean Wrap the whole batch in one transaction. Default true.

RunManyOptions

Prop Type Description
database string
statement string Single statement reused for every entry in values.
values SQLiteValues[] Non-empty list of value sets; each must exactly match the statement's placeholder count.
transaction boolean Wrap every execution in one transaction. Default true.
returnResults boolean Return per-execution { changes, lastInsertId }. Default false — leave off for max throughput.

RunManyResult / RunManyItemResult

Prop Type Description
changes number Aggregate changes across all executions.
lastInsertId 0 Aggregate operations have no single unambiguous inserted row id.
results RunManyItemResult[] Present only when returnResults: true; each item has changes and lastInsertId.

QueryOptions

Prop Type Description
database string
statement string Result-producing statement (SELECT/PRAGMA/EXPLAIN/... RETURNING).
values SQLiteValues Positional bind values.

Value types

SQLiteValue

type SQLiteValue = string | number | boolean | null | Uint8Array;

SQLiteValues

type SQLiteValues = SQLiteValue[];

See Usage → value types and BLOBs for how each JS type maps to SQLite storage and how BLOBs cross the native bridge.

Enums

SqlitePlatform

type SqlitePlatform = 'ios' | 'android' | 'web' | 'electron';

SqliteDirectory

type SqliteDirectory = 'default' | 'documents' | 'library' | 'cache';

See Platform notes for the resulting path on each platform.

SqliteErrorCode

See Error codes for the full list with causes and fixes.

Last updated on July 17, 2026