API reference › @evolu/common › NativeSqlite › createNativeSqliteDriver

function createNativeSqliteDriver(
  deps: DatabasePathDep & NativeSqliteDep,
): CreateSqliteDriver;

Defined in: packages/common/src/NativeSqlite.ts:280

Creates the CreateSqliteDriver of Evolu over a NativeSqlite binding.

A database is the file DatabasePathDep names, which the driver reads at each open. The encrypted mode opens it with the encryption key, the mode without options opens it in plaintext, and the memory mode opens a database of its own in memory.

One connection of the process holds a file at a time. A platform's WaitForDatabaseRelease can wait for another connection to close the file first, but one can still open it between that wait and the open, as a runtime still starting during an early reload does, so an open of a held file tries again, as retryWhileHeld does, and throws once it's still held 10 seconds after the first attempt.

The SqliteDriver contract has no error channel, so the driver throws what the binding throws, such as an Error whose cause is a NativeSqliteError for a wrong key.