Skip to content

Commit

Permalink
Add some @see references in the KDocs for batch execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreckYe committed Nov 14, 2024
1 parent db34477 commit eef978f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ class DatabaseClient<out VertxSqlClient : SqlClient>(
suspend fun executeBatchForVertxSqlClientRowSetSequence(statements: Iterable<Statement<*>>): Sequence<RowSet<Row>> =
executeBatch(statements) { this }

/**
* @see executeBatch
*/
@ExperimentalEvscApi
suspend inline fun <Data> executeBatchQuery(
fieldSet: FieldSet, queries: Iterable<Query>, crossinline resultRowMapper: ResultRow.() -> Data
Expand All @@ -310,7 +313,7 @@ class DatabaseClient<out VertxSqlClient : SqlClient>(
*/
/**
* Executes a batch of update statements, including [InsertStatement] and [UpdateStatement].
* @see org.jetbrains.exposed.sql.batchInsert
* @see executeBatch
* @return a sequence of the update counts of the update statements in the batch.
*/
suspend fun executeBatchUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ suspend fun <E> DatabaseClient<*>.selectBatch(
): Sequence<RowSet<ResultRow>> =
executeBatchQuery(fieldSet, data.asSequence().map { fieldSet.buildQuery(it) }.asIterable())


/**
* @see DatabaseClient.executeBatchUpdate
*/
suspend fun <T : Table, E> DatabaseClient<*>.batchInsert(
table: T, data: Iterable<E>, body: T.(InsertStatement<Number>, E) -> Unit
) =
Expand All @@ -143,6 +145,9 @@ suspend fun <T : Table, E> DatabaseClient<*>.batchInsert(
}.asIterable())
.forEach { dbAssert(it == 1) }

/**
* @see DatabaseClient.executeBatchUpdate
*/
suspend fun <T : Table, E> DatabaseClient<*>.batchInsertIgnore(
table: T, data: Iterable<E>, body: T.(InsertStatement<Number>, E) -> Unit
) =
Expand All @@ -154,13 +159,18 @@ suspend fun <T : Table, E> DatabaseClient<*>.batchInsertIgnore(

/**
* This function is not conventional and it usages are likely to degrade performance.
* @see DatabaseClient.executeBatchUpdate
*/
@ExperimentalEvscApi
suspend fun DatabaseClient<*>.batchInsertSelect(
statements: Iterable<InsertSelectStatement>
) =
executeBatchUpdate(statements)

/**
* @see DatabaseClient.executeBatchUpdate
* @see sortDataAndBatchUpdate
*/
suspend fun <T : Table, E> DatabaseClient<*>.batchUpdate(
table: T, data: Iterable<E>, where: BuildWhere? = null, limit: Int? = null, body: T.(UpdateStatement, E) -> Unit
) =
Expand All @@ -170,6 +180,7 @@ suspend fun <T : Table, E> DatabaseClient<*>.batchUpdate(

/**
* @return a sequence indicating whether each update statement is updated in the batch.
* @see batchUpdate
*/
suspend fun <T : Table, E> DatabaseClient<*>.batchSingleOrNoUpdate(
table: T, data: Iterable<E>, where: BuildWhere? = null, limit: Int? = null, body: T.(UpdateStatement, E) -> Unit
Expand All @@ -178,6 +189,7 @@ suspend fun <T : Table, E> DatabaseClient<*>.batchSingleOrNoUpdate(

/**
* @see sortDataAndExecuteBatch
* @see batchUpdate
*/
suspend fun <T : Table, E, SelectorResultT : Comparable<SelectorResultT>> DatabaseClient<*>.sortDataAndBatchUpdate(
table: T,
Expand Down

0 comments on commit eef978f

Please sign in to comment.