PowerSyncDriver

class PowerSyncDriver(db: PowerSyncDatabase, scope: CoroutineScope) : SynchronizedObject, SqlDriver(source)

A driver for SQLDelight that delegates queries to an opened PowerSync database.

Writes made through SQLDelight will trigger entries in the CRUD queue for PowerSync, allowing them to be uploaded. Similarly, writes made on the PowerSync database (both locally and those made during syncing) will update SQLDelight queries and flows.

This driver implements SqlDriver and can be passed to constructors of your SQLDelight database. Please see the readme of this library for more details to be aware of.

Constructors

Link copied to clipboard
constructor(db: PowerSyncDatabase, scope: CoroutineScope)

Functions

Link copied to clipboard
open override fun addListener(vararg queryKeys: String, listener: Query.Listener)
Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun currentTransaction(): Transacter.Transaction?
Link copied to clipboard
open override fun execute(identifier: Int?, sql: String, parameters: Int, binders: SqlPreparedStatement.() -> Unit?): QueryResult<Long>
Link copied to clipboard
open override fun <R> executeQuery(identifier: Int?, sql: String, mapper: (SqlCursor) -> QueryResult<R>, parameters: Int, binders: SqlPreparedStatement.() -> Unit?): QueryResult<R>
Link copied to clipboard
open override fun newTransaction(): QueryResult<Transacter.Transaction>
Link copied to clipboard
open override fun notifyListeners(vararg queryKeys: String)
Link copied to clipboard
open override fun removeListener(vararg queryKeys: String, listener: Query.Listener)