Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions core/api/exposed-vertx-sql-client-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public final class com/huanshankeji/exposedvertxsqlclient/DatabaseClient : com/h
public final fun executeForVertxSqlClientRowSet (Lorg/jetbrains/exposed/v1/core/statements/Statement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executePlainSql (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executePlainSqlUpdate (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executeQuery (Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executeQuery (Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQuery$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun executeQuery$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun executeQueryForList (Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQueryForList$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun executeQuery (Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executeQuery (Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQuery$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun executeQuery$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun executeQueryForList (Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQueryForList$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun executeSingleOrNoUpdate (Lorg/jetbrains/exposed/v1/core/statements/Statement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executeSingleUpdate (Lorg/jetbrains/exposed/v1/core/statements/Statement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun executeUpdate (Lorg/jetbrains/exposed/v1/core/statements/Statement;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand All @@ -67,9 +67,9 @@ public final class com/huanshankeji/exposedvertxsqlclient/DatabaseClient : com/h
public static synthetic fun exposedTransaction$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Ljava/lang/Integer;Ljava/lang/Boolean;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/Object;
public final fun getConfig ()Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClientConfig;
public final fun getExposedDatabase ()Lorg/jetbrains/exposed/v1/jdbc/Database;
public final fun getFieldExpressionSetWithOptionalReadOnlyExposedTransaction (Lorg/jetbrains/exposed/v1/jdbc/Query;Z)Ljava/util/Set;
public final fun getFieldExpressionSetWithOptionalReadOnlyExposedTransaction (Lorg/jetbrains/exposed/v1/core/AbstractQuery;Z)Ljava/util/Set;
public final fun getFieldExpressionSetWithTransaction (Lorg/jetbrains/exposed/v1/core/AbstractQuery;)Ljava/util/Set;
public final fun getFieldExpressionSetWithTransaction (Lorg/jetbrains/exposed/v1/core/FieldSet;)Ljava/util/Set;
public final fun getFieldExpressionSetWithTransaction (Lorg/jetbrains/exposed/v1/jdbc/Query;)Ljava/util/Set;
public final fun getVertxSqlClient ()Lio/vertx/sqlclient/SqlClient;
public final fun isWorking (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun runWithOptionalReadOnlyExposedTransaction (ZLkotlin/jvm/functions/Function0;)Ljava/lang/Object;
Expand All @@ -89,16 +89,16 @@ public final class com/huanshankeji/exposedvertxsqlclient/DatabaseClientConfigKt

public final class com/huanshankeji/exposedvertxsqlclient/DatabaseClientKt {
public static final fun dbAssert (Z)V
public static final fun getFieldExpressionSet (Lorg/jetbrains/exposed/v1/core/AbstractQuery;)Ljava/util/Set;
public static final fun getFieldExpressionSet (Lorg/jetbrains/exposed/v1/core/FieldSet;)Ljava/util/Set;
public static final fun getFieldExpressionSet (Lorg/jetbrains/exposed/v1/jdbc/Query;)Ljava/util/Set;
public static final fun getSavepointNameRegex ()Lkotlin/text/Regex;
public static final fun getVertxSqlClientArgTuple (Lorg/jetbrains/exposed/v1/core/statements/Statement;)Lio/vertx/sqlclient/Tuple;
public static final fun singleOrNoResult (Lio/vertx/sqlclient/RowSet;)Ljava/lang/Object;
public static final fun singleOrNoUpdate (I)Z
public static final fun singleResult (Lio/vertx/sqlclient/RowSet;)Ljava/lang/Object;
public static final fun singleStatementArguments (Lorg/jetbrains/exposed/v1/core/statements/Statement;)Ljava/lang/Iterable;
public static final fun toExposedResultRow (Lio/vertx/sqlclient/Row;Ljava/util/Set;)Lorg/jetbrains/exposed/v1/core/ResultRow;
public static final fun toExposedResultRow (Lio/vertx/sqlclient/Row;Lorg/jetbrains/exposed/v1/jdbc/Query;)Lorg/jetbrains/exposed/v1/core/ResultRow;
public static final fun toExposedResultRow (Lio/vertx/sqlclient/Row;Lorg/jetbrains/exposed/v1/core/AbstractQuery;)Lorg/jetbrains/exposed/v1/core/ResultRow;
public static final fun toVertxTuple (Ljava/lang/Iterable;)Lio/vertx/sqlclient/Tuple;
public static final fun types (Ljava/lang/Iterable;)Ljava/util/List;
public static final fun withSavepointAndRollbackIfThrows (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.jetbrains.exposed.v1.core.statements.Statement
import org.jetbrains.exposed.v1.core.statements.UpdateStatement
import org.jetbrains.exposed.v1.jdbc.Database
import org.jetbrains.exposed.v1.jdbc.Query
import org.jetbrains.exposed.v1.jdbc.SchemaUtils
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
import org.jetbrains.exposed.v1.jdbc.transactions.transactionManager
Expand Down Expand Up @@ -243,15 +242,15 @@

@Deprecated("This function is called nowhere except `Row.toExposedResultRowWithTransaction`. Consider inlining and removing it.")
@ExperimentalEvscApi
fun Query.getFieldExpressionSetWithTransaction() =
fun AbstractQuery<*>.getFieldExpressionSetWithTransaction() =

Check warning on line 245 in core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not forget to remove this deprecated code someday.

See more on https://sonarcloud.io/project/issues?id=huanshankeji_exposed-vertx-sql-client&issues=AZqn9MDEQ6fary1TIKtx&open=AZqn9MDEQ6fary1TIKtx&pullRequest=54
set.getFieldExpressionSetWithTransaction()

@Deprecated(
"This API is no longer used and will be removed. " +
"This is also of potential poor performance if accidentally called to transform multiple rows."
)
@ExperimentalEvscApi
private fun Row.toExposedResultRowWithTransaction(query: Query) =
private fun Row.toExposedResultRowWithTransaction(query: AbstractQuery<*>) =

Check warning on line 253 in core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not forget to remove this deprecated code someday.

See more on https://sonarcloud.io/project/issues?id=huanshankeji_exposed-vertx-sql-client&issues=AZqn9MDEQ6fary1TIKty&open=AZqn9MDEQ6fary1TIKty&pullRequest=54
toExposedResultRow(query.getFieldExpressionSetWithTransaction())

@PublishedApi
Expand All @@ -264,7 +263,9 @@
block()

@ExperimentalEvscApi
fun Query.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction: Boolean) =
fun AbstractQuery<*>.getFieldExpressionSetWithOptionalReadOnlyExposedTransaction(
getFieldExpressionSetWithExposedTransaction: Boolean
) =
runWithOptionalReadOnlyExposedTransaction(getFieldExpressionSetWithExposedTransaction) { getFieldExpressionSet() }

/**
Expand All @@ -277,7 +278,7 @@
)
*/
suspend inline fun <Data> executeQuery(
query: Query,
query: AbstractQuery<*>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction,
crossinline resultRowMapper: ResultRow.() -> Data
): RowSet<Data> =
Expand All @@ -302,7 +303,7 @@
)
*/
suspend fun executeQuery(
query: Query,
query: AbstractQuery<*>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction
): RowSet<ResultRow> =
executeQuery(query, getFieldExpressionSetWithExposedTransaction) { this }
Expand All @@ -313,7 +314,7 @@
*/
@ExperimentalEvscApi
suspend fun executeQueryForList(
query: Query,
query: AbstractQuery<*>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction
): List<ResultRow> {
val rowSet = executeForVertxSqlClientRowSet(query)
Expand Down Expand Up @@ -426,7 +427,7 @@
@ExperimentalEvscApi
suspend inline fun <Data> executeBatchQuery(
fieldSet: FieldSet,
queries: Iterable<Query>,
queries: Iterable<AbstractQuery<*>>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction,
crossinline resultRowMapper: ResultRow.() -> Data
): Sequence<RowSet<Data>> {
Expand All @@ -437,7 +438,9 @@
}
}

suspend fun executeBatchQuery(fieldSet: FieldSet, queries: Iterable<Query>): Sequence<RowSet<ResultRow>> =
suspend fun executeBatchQuery(
fieldSet: FieldSet, queries: Iterable<AbstractQuery<*>>
): Sequence<RowSet<ResultRow>> =
executeBatchQuery(fieldSet, queries) { this }

/*
Expand Down Expand Up @@ -491,19 +494,19 @@
/**
* @see FieldSet.getFieldExpressionSet
*/
fun Query.getFieldExpressionSet() =
fun AbstractQuery<*>.getFieldExpressionSet() =
set.getFieldExpressionSet()

/**
* @see FieldSet.getFieldExpressionSet
*/

@Deprecated(
"It's a rare case that only one row is transformed and this function calls `Query.getFieldExpressionSet` when transforming every row. " +
"It's a rare case that only one row is transformed and this function calls `AbstractQuery.getFieldExpressionSet` when transforming every row. " +
"Call `getFieldExpressionSet` directly with or without an Exposed `transaction` yourself to have finer-grained control and slightly improve performance.",
ReplaceWith("toExposedResultRow(query.getFieldExpressionSet())")
)
fun Row.toExposedResultRow(query: Query) =
fun Row.toExposedResultRow(query: AbstractQuery<*>) =

Check warning on line 509 in core/src/main/kotlin/com/huanshankeji/exposedvertxsqlclient/DatabaseClient.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not forget to remove this deprecated code someday.

See more on https://sonarcloud.io/project/issues?id=huanshankeji_exposed-vertx-sql-client&issues=AZqn9MDEQ6fary1TIKtw&open=AZqn9MDEQ6fary1TIKtw&pullRequest=54
toExposedResultRow(query.getFieldExpressionSet())

class SingleUpdateException(rowCount: Int) : Exception("update row count: $rowCount")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ public final class com/huanshankeji/exposedvertxsqlclient/crud/mapping/QueriesWi
public static final fun batchInsertIgnoreWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Iterable;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun batchInsertWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Iterable;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun batchUpdateBuilderSetter (Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;)Lkotlin/jvm/functions/Function3;
public static final fun executeQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQueryWithMapper$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun executeVertxSqlClientRowQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/jdbc/Query;Lcom/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun executeQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun executeQueryWithMapper$default (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun executeVertxSqlClientRowQueryWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/AbstractQuery;Lcom/huanshankeji/vertx/sqlclient/datamapping/RowDataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun insertIgnoreWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Object;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun insertWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/Table;Ljava/lang/Object;Lcom/huanshankeji/exposed/datamapping/DataUpdateMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun selectWithMapper (Lcom/huanshankeji/exposedvertxsqlclient/DatabaseClient;Lorg/jetbrains/exposed/v1/core/ColumnSet;Lcom/huanshankeji/exposed/datamapping/DataQueryMapper;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.huanshankeji.exposedvertxsqlclient.crud.*
import com.huanshankeji.exposedvertxsqlclient.toExposedResultRow
import com.huanshankeji.vertx.sqlclient.datamapping.RowDataQueryMapper
import io.vertx.sqlclient.RowSet
import org.jetbrains.exposed.v1.core.AbstractQuery
import org.jetbrains.exposed.v1.core.ColumnSet
import org.jetbrains.exposed.v1.core.Op
import org.jetbrains.exposed.v1.core.Table
Expand All @@ -20,7 +21,7 @@ import org.jetbrains.exposed.v1.jdbc.select

@ExperimentalEvscApi
suspend fun <Data : Any> DatabaseClient<*>.executeQueryWithMapper(
query: Query,
query: AbstractQuery<*>,
dataQueryMapper: DataQueryMapper<Data>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction
): RowSet<Data> =
Expand All @@ -36,7 +37,7 @@ suspend fun <Data : Any> DatabaseClient<*>.executeQueryWithMapper(
*/
@ExperimentalEvscApi
suspend fun <Data : Any> DatabaseClient<*>.executeVertxSqlClientRowQueryWithMapper(
query: Query, rowDataQueryMapper: RowDataQueryMapper<Data>
query: AbstractQuery<*>, rowDataQueryMapper: RowDataQueryMapper<Data>
): RowSet<Data> =
executeWithMapping(query, rowDataQueryMapper::rowToData)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import kotlin.sequences.Sequence

suspend inline fun <Data> DatabaseClient<*>.select(
columnSet: ColumnSet,
buildQuery: ColumnSet.() -> Query,
buildQuery: ColumnSet.() -> AbstractQuery<*>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction,
crossinline resultRowMapper: ResultRow.() -> Data
): RowSet<Data> =
executeQuery(columnSet.buildQuery(), getFieldExpressionSetWithExposedTransaction, resultRowMapper)

suspend inline fun DatabaseClient<*>.select(
columnSet: ColumnSet,
buildQuery: ColumnSet.() -> Query,
buildQuery: ColumnSet.() -> AbstractQuery<*>,
getFieldExpressionSetWithExposedTransaction: Boolean = config.autoExposedTransaction
): RowSet<ResultRow> =
@Suppress("MoveLambdaOutsideParentheses")
Expand Down Expand Up @@ -143,7 +143,7 @@ suspend fun <T : Table> DatabaseClient<*>.update(
*/
@ExperimentalEvscApi
suspend fun <E> DatabaseClient<*>.selectBatch(
fieldSet: FieldSet, buildQuery: FieldSet.(E) -> Query, data: Iterable<E>
fieldSet: FieldSet, buildQuery: FieldSet.(E) -> AbstractQuery<*>, data: Iterable<E>
): Sequence<RowSet<ResultRow>> =
executeBatchQuery(fieldSet, data.asSequence().map { fieldSet.buildQuery(it) }.asIterable())

Expand Down