SqliteClient
Connects Effect SQL to SQLite on Node.js using node:sqlite.
This module opens a SQLite database and exposes it as both SqliteClient and
the generic Effect SQL client. It serializes access through one connection,
caches prepared statements, enables WAL mode unless disabled, and waits up
to five seconds for busy databases by default. Explicit transactions on
writable connections use BEGIN IMMEDIATE to avoid read-to-write lock
upgrades, which serializes them behind other writers even when they only
read. Clients opened with readonly: true are unaffected. Busy waits block
the Node.js event loop because node:sqlite is synchronous. Database backup
and extension loading are supported; streaming queries and updateValues
are not.
Constructors
Creates a scoped node SQLite client from the supplied configuration, using a single serialized connection with WAL and a 5-second busy timeout enabled by default. Explicit transactions on writable connections take the write lock for their duration, even when they only read; clients opened with readonly: true are unaffected.
Signature
declare function make(options: SqliteClientConfig): Effect<SqliteClient, never, any>Layers
Builds a layer from a node SQLite client configuration, providing both SqliteClient and the generic SqlClient service.
Signature
declare function layer(config: SqliteClientConfig): Layer<any>layerConfig
Builds a layer from an Effect Config value, providing both the node SqliteClient service and the generic SqlClient service.
Signature
declare function layerConfig(config: Wrap<SqliteClientConfig>): Layer<any, ConfigError>Models
BackupMetadata interface
Metadata returned from a Node SQLite backup operation, reporting total and remaining page counts.
Signature
interface BackupMetadata { readonly remainingPages: number; readonly totalPages: number;}SqliteClientConfig interface
Configuration for a node SQLite client backed by node:sqlite, including the database filename, read-only mode, statement cache settings, WAL and busy timeout behavior, span attributes, and query/result name transforms.
Signature
interface SqliteClientConfig { readonly busyTimeout?: any; readonly disableWAL?: boolean; readonly filename: string; readonly prepareCacheSize?: number; readonly prepareCacheTTL?: any; readonly readonly?: boolean; readonly spanAttributes?: Record<string, unknown>; readonly transformQueryNames?: (str: string) => string; readonly transformResultNames?: (str: string) => string;}Services
SqliteClient
Service tag for the node SQLite client implementation.
Signature
declare const SqliteClient: anySqliteClient interface
Node SQLite client service, extending SqlClient with database export, backup, and extension loading helpers. updateValues is not supported.
Signature
interface SqliteClient extends unknown { readonly "~@effect/sql-sqlite-node/SqliteClient": "~@effect/sql-sqlite-node/SqliteClient"; readonly backup: (destination: string) => Effect<BackupMetadata, SqlError>; readonly config: SqliteClientConfig; readonly loadExtension: (path: string) => Effect<void, SqlError>; readonly updateValues: never;}