SingleConnectionPool

A SQLiteConnectionPool backed by a single database connection.

This does not provide any concurrency, but is still a reasonable implementation to use for e.g. tests.

Constructors

Link copied to clipboard
constructor(conn: SQLiteConnection)

Properties

Link copied to clipboard
open override val updates: SharedFlow<Set<String>>

Returns a flow of table updates made on the write connection.

Functions

Link copied to clipboard
open suspend override fun close()

Closes the connection pool and associated resources.

Link copied to clipboard
open suspend override fun <T> read(callback: suspend (SQLiteConnectionLease) -> T): T

Calls the callback with a read-only connection temporarily leased from the pool.

Link copied to clipboard
open suspend override fun <R> withAllConnections(action: suspend (writer: SQLiteConnectionLease, readers: List<SQLiteConnectionLease>) -> R)

Invokes the callback with all connections leased from the pool.

Link copied to clipboard
open suspend override fun <T> write(callback: suspend (SQLiteConnectionLease) -> T): T

Calls the callback with a read-write connection temporarily leased from the pool.