Package-level declarations

Types

Link copied to clipboard
typealias ResultRow = Map<String, Any?>

Functions

Link copied to clipboard
fun Flow<Result>.asRows(): Flow<Row>

Extension function for Flow that emits the rows retrieved by a query.

Link copied to clipboard
fun <T> Connection.batchUpdate(upstream: Flow<T>, concurrency: Int = 1, groupStrategy: GroupStrategy = GroupStrategy.TimeWindow(100, 250.milliseconds), query: (T) -> String): Flow<Result>

Executes a batch update for a specified upstream flow of items using a given groupStrategy and concurrency. The query function transforms each item in the upstream flow into a respective SQL query string. Returns a flow of long values representing the number of rows updated in the database for each chunk.

fun <T> Connection.batchUpdate(sql: String, upstream: Flow<T>, returning: Returning = Returning.Default, concurrency: Int = 1, groupStrategy: GroupStrategy = GroupStrategy.TimeWindow(100, 250.milliseconds), prepare: Statement.(T) -> Unit = {}): Flow<Result>

Executes a batch update with the specified SQL statement and values from a flow of items. This function chunks the items in the flow and executes the chunks concurrently. Optionally, it can return generated values (e.g. auto-generated keys) from the inserted records.

Link copied to clipboard
fun <T> Flow<Result>.mapRow(f: suspend (Row) -> T): Flow<T>

Extension function for Flow that maps each row to a custom type using the provided lambda function.

Link copied to clipboard
fun Connection.query(sql: String, prepare: Statement.() -> Unit = {}): Flow<ResultRow>

Executes an SQL query and retrieves a Flow of ResultRows representing the returned data.

Link copied to clipboard
fun Flow<Result>.rowsUpdated(): Flow<Long>

Extension function for Flow that emits the number of updated rows.

Link copied to clipboard
fun Connection.singleUpdate(sql: String): Flow<Long>

Executes a single SQL update statement and returns the number of rows affected as a Flow.

fun <T> Connection.singleUpdate(sql: String, upstream: Flow<T>, concurrency: Int = 1, prepare: Statement.(T) -> Unit = {}): Flow<Long>

Executes an SQL update statement for each item in the provided upstream Flow.