Skip to content

routier-collection


routier-collection / plugins/sqlite/src / SqliteDbPlugin

Class: SqliteDbPlugin

Defined in: plugins/sqlite/src/index.ts:21

SQLite for Node, on node:sqlite.

This entry point is selected by the node condition in the package manifest. A browser bundler resolves the browser condition instead and gets the WASM build, so neither environment ever loads the other's engine.

Needs Node 22.5 or later. On Node 18 or 20, pass the sqlite3 driver:

import { sqlite3Driver } from '@routier/sqlite-plugin/drivers/sqlite3'; new SqliteDbPlugin('app.db', { driver: sqlite3Driver() });

Extends

Constructors

Constructor

new SqliteDbPlugin(databaseName, options): SqliteDbPlugin

Defined in: plugins/sqlite/src/index.ts:22

Parameters

databaseName

string

options

SqliteDbPluginOptions = {}

Returns

SqliteDbPlugin

Overrides

SqliteDbPluginBase.constructor

Properties

databaseName

readonly databaseName: string

Defined in: plugins/sqlite/src/plugin.ts:53

See IDbPlugin.databaseName. This is the file path as the caller spelled it, which is as far as a plugin that also runs in the browser can go: resolving it needs a file system. Two spellings of one file — a relative and an absolute path — therefore read as two databases and will not share subscription channels. Pass a consistent path.

Inherited from

SqliteDbPluginBase.databaseName

Methods

query()

query<TRoot, TShape>(event, done): void

Defined in: plugins/sqlite/src/plugin.ts:159

Executes a query operation on the database.

Type Parameters

TRoot

TRoot extends object

TShape

TShape extends unknown = TRoot

Parameters

event

DbPluginQueryEvent<TRoot, TShape>

The query event containing schema, parent, and query operation.

done

PluginEventCallbackResult<ITranslatedValue<TShape>>

Callback with the result or error.

Returns

void

Inherited from

SqliteDbPluginBase.query


bulkPersist()

bulkPersist(event, done): void

Defined in: plugins/sqlite/src/plugin.ts:254

Executes bulk operations (add, update, remove) on the database.

Parameters

event

DbPluginBulkPersistEvent

The bulk operations event containing schema, parent, and changes.

done

PluginEventCallbackPartialResult<BulkPersistResult>

Callback with the result or error.

Returns

void

Inherited from

SqliteDbPluginBase.bulkPersist


destroy()

destroy(event, done): void

Defined in: plugins/sqlite/src/plugin.ts:357

Destroys or cleans up the plugin, closing connections or freeing resources.

Parameters

event

DbPluginEvent

done

PluginEventCallbackResult<never>

Callback with an optional error.

Returns

void

Inherited from

SqliteDbPluginBase.destroy

Released under the MIT License.