Package-level declarations

Types

Link copied to clipboard
abstract class CrudRepository<ID : Comparable<ID>, E : Entity<ID>>(provider: DatabaseProvider) : Repository<ID, E>

Abstract repository that provides full CRUD operations on top of Repository.

Link copied to clipboard
abstract class DatabaseBuilder

Abstract builder class for constructing a DatabaseProvider.

Link copied to clipboard
data class DatabaseConfig(val driver: String, val url: String, val user: String = "", val password: String = "")

Data class representing the configuration for a database connection.

Link copied to clipboard
annotation class DatabaseDsl

Marker annotation for Database DSL.

Link copied to clipboard

Interface for abstracting database access.

Link copied to clipboard
interface Migration

Represents a single schema migration step.

Link copied to clipboard
class MigrationRunner(provider: DatabaseProvider, migrations: List<Migration>)

Applies pending migrations against the given provider.

Link copied to clipboard
data class PageResult<T>(val items: List<T>, val total: Long, val offset: Long, val limit: Int)

A slice of query results with pagination metadata.

Link copied to clipboard
interface Repository<ID : Comparable<ID>, E : Entity<ID>>

Interface for DAO-based repositories.

Functions

Link copied to clipboard
infix fun () -> Op<Boolean>.and(other: () -> Op<Boolean>): () -> Op<Boolean>

Combines two Exposed where-clause predicates with AND.

Link copied to clipboard
fun <T> dbQuery(database: Database? = null, statement: Transaction.() -> T): T

Executes a transaction synchronously.

Link copied to clipboard
suspend fun <T> dbQuerySuspend(database: Database? = null, statement: suspend Transaction.() -> T): T

Executes a transaction asynchronously using Kotlin coroutines.

Link copied to clipboard
fun DatabaseProvider.forEachTable(statement: Transaction.(Table) -> Unit)

Executes a statement for each table registered in the provider.

Link copied to clipboard
fun migration(version: Int, description: String = "Migration v", block: Transaction.() -> Unit): Migration

Creates a Migration inline via a DSL block.

Link copied to clipboard
infix fun () -> Op<Boolean>.or(other: () -> Op<Boolean>): () -> Op<Boolean>

Combines two Exposed where-clause predicates with OR.

Link copied to clipboard
infix operator fun () -> Op<Boolean>.plus(other: () -> Op<Boolean>): () -> Op<Boolean>
Link copied to clipboard
fun <T : Table, R> T.query(provider: DatabaseProvider, statement: Transaction.(T) -> R): R

Extension function for Table to execute a query within its context.

Link copied to clipboard
suspend fun <T : Table, R> T.querySuspend(provider: DatabaseProvider, statement: Transaction.(T) -> R): R

Extension function for Table to execute an asynchronous query within its context.

Link copied to clipboard
fun <T : Table, R> T.selectPage(provider: DatabaseProvider, offset: Long = 0, limit: Int = 20, where: () -> Op<Boolean>? = null, orderBy: List<Pair<Expression<*>, SortOrder>> = emptyList(), mapper: ResultRow.(T) -> R): PageResult<R>

Executes a paginated SELECT against this table inside a provider transaction.