Package-level declarations

Types

Link copied to clipboard

Marks API that is public only for backend modules and shared tests.

Link copied to clipboard

Database connection of a SQLite backend module, wrapped by SQLiteDriver. Implementations throw SQLiteJsException on SQLite errors.

Link copied to clipboard
class SQLiteConnectionTask(open: (filename: String) -> SQLiteConnection) : Task<String, Unit>

Worker side of openWorkerConnection: opens the connection with open and serves requests of the main thread until it closes the connection.

Link copied to clipboard
class SQLiteDriver(connection: SQLiteConnection, beginImmediate: Boolean = false, readers: List<SQLiteConnection> = emptyList()) : SqlDriver

Asynchronous SQLDelight driver on top of a SQLiteConnection provided by a backend module.

Link copied to clipboard
open class SQLiteException(message: String) : Exception

Exception of SQLiteDriver. Usually this class is directly returned in case of error within driver itself.

Link copied to clipboard

Exception that occurs from within the SQLite Node.js module of the backend.

Link copied to clipboard
interface SQLiteStatement

Prepared statement of a SQLiteConnection.

Functions

Link copied to clipboard
suspend fun <T : Any> Query<T>.executeAsFlow(): Flow<T>

Workaround suspending method to use with SQLite async driver. Use this instead of non-async method Query.executeAsList.

Link copied to clipboard
suspend fun openWorkerConnection(taskName: String, registrarModule: String, filename: String): SQLiteConnection

Opens a connection in its own worker thread. The thread imports registrarModule, which registers a SQLiteConnectionTask as taskName. Requests and rows go over a MessagePort by structured clone.

Link copied to clipboard
suspend fun openWorkerDriver(taskName: String, registrarModule: String, filename: String, beginImmediate: Boolean, readers: Int): SQLiteDriver

Opens a SQLiteDriver with a writer and readers reader connections, each by openWorkerConnection. Readers need WAL, so the writer switches the database file to it first.

Link copied to clipboard

Converts SQLiteStatement.bind parameters for backends that bind JS numbers as REAL, Long becomes a JS BigInt so it is bound as INTEGER.

Link copied to clipboard
suspend fun SQLiteDriver.withSchema(schema: SqlSchema<QueryResult.AsyncValue<Unit>>? = null): SQLiteDriver

Creates schema (if given) on this driver, used by backend modules' init functions.

Link copied to clipboard
inline fun <T> wrapJsErrors(block: () -> T): T

Runs block and rethrows any JS error as SQLiteJsException.