Package-level declarations

Types

Link copied to clipboard
sealed interface ConnectionConfig

Common configuration for database connections to both Vert.x SqlClient and Exposed Database, currently supporting both TCP socket and Unix domain socket connections.

Link copied to clipboard
Link copied to clipboard
class DatabaseClient<out VertxSqlClientT : SqlClient>(val vertxSqlClient: VertxSqlClientT, val config: DatabaseClientConfig) : CoroutineAutoCloseable, StatementPreparationExposedTransactionProvider

The main entry point for executing database operations using Vert.x SQL Client with Exposed SQL generation.

Link copied to clipboard

Configuration interface for DatabaseClient behavior.

Link copied to clipboard
class DatabaseExposedTransactionProvider(val database: Database, val transactionIsolation: Int? = Connection.TRANSACTION_READ_UNCOMMITTED) : StatementPreparationExposedTransactionProvider

A StatementPreparationExposedTransactionProvider that creates a new transaction for each call using an Exposed Database.

Link copied to clipboard
class EvscConfig(val exposedConnectionConfig: ConnectionConfig.Socket, val vertxSqlClientConnectionConfig: ConnectionConfig) : IEvscConfig

Note that this API is experimental and subject to change.

Link copied to clipboard
annotation class EvscInternalApi

Marks APIs that are internal to the Exposed Vert.x SQL Client library.

Link copied to clipboard
Link copied to clipboard
typealias ExposedArguments = Iterable<Pair<IColumnType<*>, Any?>>
Link copied to clipboard
interface IEvscConfig

Note that this API is experimental and subject to change.

Link copied to clipboard
annotation class InternalApi

A StatementPreparationExposedTransactionProvider that reuses a single JdbcTransaction for all SQL preparation calls.

Link copied to clipboard

Provider interface for creating and managing Exposed transactions used for SQL statement preparation.

Properties

Functions

Link copied to clipboard
inline fun DatabaseClientConfig(statementPreparationExposedTransactionProvider: StatementPreparationExposedTransactionProvider, validateBatch: Boolean = true, logSql: Boolean = false, autoExposedTransaction: Boolean = false, crossinline exposedPreparedSqlToVertxSqlClientPreparedSql: (preparedSql: String) -> String): DatabaseClientConfig

See the DatabaseClientConfig interface for parameter descriptions.

Link copied to clipboard
Link copied to clipboard
suspend fun DatabaseClient<Pool>.getConnectionClient(): DatabaseClient<SqlConnection>
Link copied to clipboard
fun FieldSet.getFieldExpressionSet(): Set<Expression<*>>

An Exposed transaction is required if the FieldSet contains custom functions that depend on dialects.

fun Query.getFieldExpressionSet(): Set<Expression<*>>
Link copied to clipboard
suspend fun DatabaseClient<Pool>.getVertxPoolConnection(): SqlConnection
Link copied to clipboard
fun Statement<*>.getVertxSqlClientArgTuple(): Tuple?

This method has to be called within an ExposedTransaction.

Link copied to clipboard
fun requireSqlIdentifier(identifier: String)

To prevent SQL injection. Does not take into account quoted identifiers yet.

Link copied to clipboard
fun <R> RowSet<R>.singleOrNoResult(): R?

"single or no" means differently here from Iterable.singleOrNull.

Link copied to clipboard
Link copied to clipboard
fun <R> RowSet<R>.singleResult(): R
Link copied to clipboard
fun Statement<*>.singleStatementArguments(): Iterable<Pair<IColumnType<*>, Any?>>?
Link copied to clipboard
fun Row.toExposedResultRow(fieldExpressionSet: Set<Expression<*>>): ResultRow
fun Row.toExposedResultRow(query: Query): ResultRow
Link copied to clipboard

Converts this socket connection config to an EvscConfig using the same config for both Vert.x SqlClient and Exposed Database. This is the simplest configuration for standard TCP/IP connections.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ExposedArguments.types(): List<IColumnType<*>>
Link copied to clipboard
suspend fun <T> DatabaseClient<Pool>.withConnectionClient(block: suspend (DatabaseClient<SqlConnection>) -> T): T
Link copied to clipboard
suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<SqlConnectionT>.withSavepoint(savepointName: String, function: suspend (DatabaseClient<SqlConnectionT>) -> T): T
Link copied to clipboard
suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<SqlConnectionT>.withSavepointAndRollbackIfThrows(savepointName: String, function: suspend (DatabaseClient<SqlConnectionT>) -> T): T

An alias of withSavepoint.

Link copied to clipboard
suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<SqlConnectionT>.withSavepointAndRollbackIfThrowsOrNone(savepointName: String, function: suspend (DatabaseClient<SqlConnectionT>) -> Option<T>): Option<T>
Link copied to clipboard

Currently only supported with PostgreSQL. A savepoint destroys one with the same name so be careful.

Link copied to clipboard
@JvmName(name = "withTransactionForSqlConnection")
suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<SqlConnectionT>.withTransaction(function: suspend (DatabaseClient<SqlConnectionT>) -> T): T

@JvmName(name = "withTransactionForPool")
suspend fun <T> DatabaseClient<Pool>.withTransaction(function: suspend (DatabaseClient<SqlConnection>) -> T): T

When using this function, it's recommended to name the lambda parameter the same as the outer receiver so that the outer DatabaseClient is shadowed, and so that you don't call the outer DatabaseClient without a transaction by accident.

Link copied to clipboard
suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<SqlConnectionT>.withTransactionCommitOrRollback(function: suspend (DatabaseClient<SqlConnectionT>) -> Option<T>): Option<T>
Link copied to clipboard
@JvmName(name = "withTransactionEitherForSqlConnection")
suspend fun <SqlConnectionT : SqlConnection, RollbackResult, CommitResult> DatabaseClient<SqlConnectionT>.withTransactionEither(function: suspend (DatabaseClient<SqlConnectionT>) -> Either<RollbackResult, CommitResult>): Either<RollbackResult, CommitResult>

@JvmName(name = "withTransactionEitherForPool")
suspend fun <RollbackResult, CommitResult> DatabaseClient<Pool>.withTransactionEither(function: suspend (DatabaseClient<SqlConnection>) -> Either<RollbackResult, CommitResult>): Either<RollbackResult, CommitResult>

When using this function, it's recommended to name the lambda parameter the same as the outer receiver so that the outer DatabaseClient is shadowed, and so that you don't call the outer DatabaseClient without a transaction by accident.

Link copied to clipboard

Polymorphic transaction function for DatabaseClient<*> with either Pool or SqlConnection as the DatabaseClient.vertxSqlClient.

Link copied to clipboard
suspend fun <T> DatabaseClient<*>.withTransactionPolymorphic(function: suspend (DatabaseClient<SqlConnection>) -> T): T

Polymorphic transaction function for DatabaseClient<*> with either Pool or SqlConnection as the DatabaseClient.vertxSqlClient.

Link copied to clipboard
inline suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<Pool>.withTypedTransaction(crossinline function: suspend (DatabaseClient<SqlConnectionT>) -> T): T

A variant of withTransaction that casts the SqlConnection to a specific subtype.

Link copied to clipboard
inline suspend fun <SqlConnectionT : SqlConnection, T> DatabaseClient<*>.withTypedTransactionPolymorphic(noinline function: suspend (DatabaseClient<SqlConnectionT>) -> T): T

Polymorphic transaction function for DatabaseClient<*> with either Pool or SqlConnection as the DatabaseClient.vertxSqlClient.

Link copied to clipboard