Skip to content

SqliteWrapper

github-actions[bot] edited this page Jan 12, 2025 · 3 revisions

@gavinhsmith/simpledb


@gavinhsmith/simpledb / lib/wrapper / SqliteWrapper

Type Alias: SqliteWrapper

SqliteWrapper: object

Defined in: lib/wrapper.ts:15

A wrapper around sqlite for clean up use.

Type declaration

close()

readonly close: () => Promise<Error | null>

Cancel the current operation if one exists and shut down the database.

Returns

Promise<Error | null>

A promise that always resolves when done. May contain an error in paramater, but will not reject.

exec()

readonly exec: (sql, params?) => Promise<void>

Execute a query on the database, does not return any data.

Parameters

sql

string

The SQL query to execute.

params?

Paramaters

Paramaters to inject. Uses $name format in SQL, so use { $key: replacement }.

Returns

Promise<void>

A promise that resolves when completed, or rejects if an error occurs.

getInstance()

readonly getInstance: () => SQLiteDatabase

Gets the instance of sqlite3 being used.

Returns

SQLiteDatabase

The internal instance of the sqlite3 Database.

query()

readonly query: <ResponseType>(sql, params?) => Promise<ResponseType[]>

Execute a query on the database, returns all fetched data.

Type Parameters

• ResponseType

Parameters

sql

string

The SQL query to execute.

params?

Paramaters

Paramaters to inject. Uses $name format in SQL.

Returns

Promise<ResponseType[]>

A promise that resolves into the requested rows, or rejects if an error occurs.

Clone this wiki locally