Package-level declarations

Types

Link copied to clipboard
Utility class to use connections given by the ConnectionSupplier.
Link copied to clipboard
Link copied to clipboard
@InterfacedService(acceptMultiple = false)
@MissingServiceMessage(message = "Using a database required a service implementing ConnectionSupplier")
interface ConnectionSupplier

Allows access to an SQL database.

Link copied to clipboard
@InterfacedService(acceptMultiple = false)
interface Database

Utility class to use connections given by the ConnectionSupplier, in a suspending style.

Link copied to clipboard

Utility class to iterate over a ResultSet, with a few methods to use nullable objects instead of booleans.

Link copied to clipboard

Sub-interface of ConnectionSupplier delegating simple HikariDataSource getters.

Link copied to clipboard
Functional interface for Java JDBC prepared statements.
Link copied to clipboard
Link copied to clipboard
Functional interface for Java JDBC transactions.

Properties

Functions

Link copied to clipboard
fun DBResult.getKotlinInstant(columnName: String): Instant
Link copied to clipboard
fun DBResult.getKotlinInstantOrNull(columnName: String): Instant?
Link copied to clipboard
inline suspend fun <R> Database.preparedStatement(@Language(value = "PostgreSQL") sql: String, readOnly: Boolean = false, columnNames: Array<out String>, block: SuspendingPreparedStatement.() -> R): R
inline suspend fun <R> Database.preparedStatement(@Language(value = "PostgreSQL") sql: String, readOnly: Boolean = false, generatedKeys: Boolean = false, block: SuspendingPreparedStatement.() -> R): R
inline suspend fun <R> Database.preparedStatement(@Language(value = "PostgreSQL") sql: String, readOnly: Boolean = false, columnIndexes: IntArray, block: SuspendingPreparedStatement.() -> R): R

Creates a statement from the given SQL statement, runs the block, commits the changes and closes the connection.

Link copied to clipboard
inline suspend fun <R> Database.transactional(readOnly: Boolean = false, crossinline block: suspend Transaction.() -> R): R

Acquires a database connection, runs the block, commits the changes and closes the connection.

Link copied to clipboard
fun PreparedStatement.withLogger(logger: KLogger)
fun PreparedStatement.withLogger(logger: Logger)

Sets the logger used to log the query.