Package-level declarations

Types

Link copied to clipboard
sealed interface ConnectionConfig
Link copied to clipboard
Link copied to clipboard
class DatabaseClient<out VertxSqlClient : SqlClient>(val vertxSqlClient: VertxSqlClient, val exposedDatabase: Database, val validateBatch: Boolean = true, val logSql: Boolean = false)

A wrapper client around Vert.x SqlClient for queries and an Exposed Database to generate SQLs working around the limitations of Exposed.

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

This API is not used in the factory function parameter types yet. TODO

Link copied to clipboard
typealias ExposedArguments = Iterable<Pair<IColumnType<*>, Any?>>
Link copied to clipboard
interface IEvscConfig
Link copied to clipboard
class LocalConnectionConfig(val database: String, val user: String, val socketConnectionPassword: String)

A kind of connection config that can produce both a ConnectionConfig.Socket and a ConnectionConfig.UnixDomainSocketWithPeerAuthentication to connect to a local database server.

Link copied to clipboard

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun createBetterPgPoolDatabaseClient(vertx: Vertx?, localConnectionConfig: LocalConnectionConfig, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf(), exposedDatabase: Database? = null): DatabaseClient<PgPool>
inline fun <Client, PoolOptionsT : PoolOptions?> createPeerAuthenticationUnixDomainSocketGenericPgClient(vertx: Vertx?, unixDomainSocketPath: String, database: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptionsT, create: (Vertx?, PgConnectOptions, PoolOptionsT) -> Client): Client
suspend fun createPeerAuthenticationUnixDomainSocketPgConnectionAndSetRole(vertx: Vertx?, host: String, database: String, role: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}): PgConnection
fun createPeerAuthenticationUnixDomainSocketPgPool(vertx: Vertx?, unixDomainSocketPath: String, database: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): PgPool
fun createPeerAuthenticationUnixDomainSocketPgPoolAndSetRole(vertx: Vertx?, host: String, database: String, role: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): PgPool
fun createPeerAuthenticationUnixDomainSocketPgSqlClient(vertx: Vertx?, unixDomainSocketPath: String, database: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): SqlClient
Link copied to clipboard
fun createPgPoolDatabaseClient(vertx: Vertx?, vertxSqlClientConnectionConfig: ConnectionConfig, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf(), exposedSocketConnectionConfig: ConnectionConfig.Socket): DatabaseClient<PgPool>
fun createPgPoolDatabaseClient(vertx: Vertx?, vertxSqlClientConnectionConfig: ConnectionConfig, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf(), exposedDatabase: Database): DatabaseClient<PgPool>

fun createPgPoolDatabaseClient(vertx: Vertx?, vertxSqlClientConnectionType: ConnectionType, localConnectionConfig: LocalConnectionConfig, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf(), exposedDatabase: Database? = null): DatabaseClient<PgPool>

It may be more efficient to use a single shared Database to generate SQLs for multiple DatabaseClients/SqlClients.

Link copied to clipboard
inline fun <Client, PoolOptionsT : PoolOptions?> createSocketGenericPgClient(vertx: Vertx?, host: String, port: Int?, database: String, user: String, password: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptionsT, create: (Vertx?, PgConnectOptions, PoolOptionsT) -> Client): Client
Link copied to clipboard
suspend fun createSocketPgConnection(vertx: Vertx?, host: String, port: Int?, database: String, user: String, password: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}): PgConnection
Link copied to clipboard
fun createSocketPgPool(vertx: Vertx?, host: String, port: Int?, database: String, user: String, password: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): PgPool
Link copied to clipboard
fun createSocketPgSqlClient(vertx: Vertx?, host: String, port: Int?, database: String, user: String, password: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): SqlClient
suspend fun createUnixDomainSocketPgSqlClientAndSetRole(vertx: Vertx?, host: String, database: String, role: String, extraPgConnectOptions: PgConnectOptions.() -> Unit = {}, poolOptions: PoolOptions = poolOptionsOf()): SqlClient
Link copied to clipboard
suspend fun SqlConnection.executeSetRole(role: String): RowSet<Row>
Link copied to clipboard
fun exposedDatabaseConnectPostgreSql(socketConnectionConfig: ConnectionConfig.Socket): Database
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
fun Statement<*>.getVertxPgClientPreparedSql(transaction: Transaction): String
Link copied to clipboard
fun Statement<*>.getVertxSqlClientArgTuple(): Tuple?

This method has to be called within an ExposedTransaction.

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
Link copied to clipboard
fun ExposedArguments.types(): List<IColumnType<*>>
Link copied to clipboard
suspend fun <T> DatabaseClient<PgPool>.withPgTransaction(function: suspend (DatabaseClient<PgConnection>) -> T): T
Link copied to clipboard
suspend fun <T> DatabaseClient<PgConnection>.withSavepointAndRollbackIfThrows(savepointName: String, function: suspend (DatabaseClient<PgConnection>) -> T): T
Link copied to clipboard
suspend fun DatabaseClient<PgConnection>.withSavepointAndRollbackIfThrowsOrFalse(savepointName: String, function: suspend (DatabaseClient<PgConnection>) -> Boolean): Boolean
Link copied to clipboard
suspend fun <RollbackT, ReleaseT> DatabaseClient<PgConnection>.withSavepointAndRollbackIfThrowsOrLeft(savepointName: String, function: suspend (DatabaseClient<PgConnection>) -> Either<RollbackT, ReleaseT>): Either<RollbackT, ReleaseT>

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

Link copied to clipboard
suspend fun <T> DatabaseClient<PgConnection>.withSavepointAndRollbackIfThrowsOrNone(savepointName: String, function: suspend (DatabaseClient<PgConnection>) -> Option<T>): Option<T>
Link copied to clipboard
suspend fun <T> DatabaseClient<PgPool>.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 <T> DatabaseClient<SqlConnection>.withTransactionCommitOrRollback(function: suspend (DatabaseClient<SqlConnection>) -> Option<T>): Option<T>