NitroSQLite
nitro-sqliteInterfaces

TypeOrmConnection

TypeScript

Source files: TypeScript

Callback-oriented connection returned to TypeORM. Destroy the owning DataSource to close the connection.

Deprecated

Import from react-native-nitro-sqlite-typeorm on React Native or nitro-sqlite-typeorm on NitroUI instead.

Properties

attach

attach: (dbNameToAttach, alias, location, callback) => void

Defined in: packages/nitro-sqlite/src/typeORM.ts:60

Attach another database to this connection synchronously.

Parameters

dbNameToAttach

string

Database file name to attach.

alias

string

Schema alias used to qualify attached tables.

location

string | undefined

Relative directory, or undefined for the default directory.

callback

() => void

Called after the database attaches.

Returns

void

Throws

The SQLite error when attachment fails. The callback is not called.


close

close: (okClose, failClose) => void

Defined in: packages/nitro-sqlite/src/typeORM.ts:51

Close the underlying database connection synchronously.

Parameters

okClose

() => void

Called after the connection closes.

failClose

(e) => void

Receives a close failure, including active transaction errors.

Returns

void

Nothing. TypeORM calls this method during DataSource.destroy().


detach

detach: (alias, callback) => void

Defined in: packages/nitro-sqlite/src/typeORM.ts:72

Detach an attached database from this connection synchronously.

Parameters

alias

string

Attached schema alias to detach.

callback

() => void

Called after the database detaches.

Returns

void

Throws

The SQLite error when detachment fails. The callback is not called.


executeSql

executeSql: <RowData>(sql, params, okExecute, failExecute) => Promise<void>

Defined in: packages/nitro-sqlite/src/typeORM.ts:32

Execute SQL asynchronously on the managed connection.

Type Parameters

RowData

RowData extends QueryResultRow = never

Parameters

sql

string

SQL statement to execute.

params

SQLiteQueryParams | undefined

Positional values, or undefined when SQL has no parameters.

okExecute

(res) => void

Receives the typed query result after successful execution.

failExecute

(msg) => void

Receives the caught failure value. The string annotation preserves the legacy signature; actual failures can be Error objects.

Returns

Promise<void>

A promise that settles after the corresponding callback runs.


transaction

transaction: (fn) => Promise<void>

Defined in: packages/nitro-sqlite/src/typeORM.ts:44

Run TypeORM work in Nitro SQLite's managed transaction queue.

Parameters

fn

(tx) => Promise<void>

Receives the active transaction. Await all work inside it.

Returns

Promise<void>

A promise that resolves after commit, or rejects after rollback when the callback or a transaction operation fails.

On this page