typeORMDriver
TypeScriptSource files: TypeScript
const typeORMDriver: object = legacyDriver
SQLite callback adapter for TypeORM's react-native DataSource type.
Pass this object as the DataSource's driver option. openDatabase accepts
a database name, optional relative location, and optional SEE
encryptionKey. It calls ok and returns the connection on success, or
calls fail and returns null when opening fails.
This package shares the core adapter implementation so legacy core imports and this entry point use the same connection lifecycle and callbacks. TypeORM and Nitro SQLite must be installed as peer dependencies.
Type Declaration
openDatabase
openDatabase: (options, ok, fail) => TypeOrmNitroSQLiteConnection | null
Open a database for TypeORM.
Parameters
options
Database name, optional relative directory, and optional SEE key.
encryptionKey?
string
Key for a licensed SQLite SEE build. Without SEE, a supplied key fails
with EncryptionNotEnabled. An existing plaintext file is rejected.
location?
string
Directory relative to the platform database directory.
name
string
Database file name.
ok
(db) => void
Receives the adapter connection on success.
fail
(msg) => void
Receives the opening error on failure.
Returns
TypeOrmNitroSQLiteConnection | null