Queries

interface Queries

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun execute(sql: String, parameters: List<Any?>? = listOf()): Long

Executes a write query (INSERT, UPDATE, DELETE).

Link copied to clipboard
abstract suspend fun <RowType : Any> get(sql: String, parameters: List<Any?>? = listOf(), mapper: (SqlCursor) -> RowType): RowType

Executes a read-only (SELECT) query and returns a single result.

Link copied to clipboard
abstract suspend fun <RowType : Any> getAll(sql: String, parameters: List<Any?>? = listOf(), mapper: (SqlCursor) -> RowType): List<RowType>

Executes a read-only (SELECT) query and returns all results.

Link copied to clipboard
abstract suspend fun <RowType : Any> getOptional(sql: String, parameters: List<Any?>? = listOf(), mapper: (SqlCursor) -> RowType): RowType?

Executes a read-only (SELECT) query and returns a single optional result.

Link copied to clipboard
abstract fun onChange(tables: Set<String>, throttleMs: Long = DEFAULT_THROTTLE.inWholeMilliseconds, triggerImmediately: Boolean = true): Flow<Set<String>>

Returns a Flow that emits whenever the source tables are modified.

Link copied to clipboard
abstract suspend fun <R> readLock(callback: ThrowableLockCallback<R>): R

Takes a read lock without starting a transaction.

Link copied to clipboard
abstract suspend fun <R> readTransaction(callback: ThrowableTransactionCallback<R>): R

Opens a read-only transaction.

Link copied to clipboard
abstract fun <RowType : Any> watch(sql: String, parameters: List<Any?>? = listOf(), throttleMs: Long = DEFAULT_THROTTLE.inWholeMilliseconds, mapper: (SqlCursor) -> RowType): Flow<List<RowType>>

Executes a read-only (SELECT) query every time the source tables are modified and returns the results as a Flow of lists.

Link copied to clipboard
abstract suspend fun <R> writeLock(callback: ThrowableLockCallback<R>): R

Takes a global lock without starting a transaction.

Link copied to clipboard
abstract suspend fun <R> writeTransaction(callback: ThrowableTransactionCallback<R>): R

Opens a read-write transaction.