KeelDatabase

class KeelDatabase(database: Database)(source)

Database connection manager for the Keel framework. Provides connection pooling, transaction management, and query helpers.

Constructors

Link copied to clipboard
constructor(database: Database)

Functions

Link copied to clipboard
fun createTables(vararg tables: Table)

Create tables for a plugin. This should be called during plugin initialization.

Link copied to clipboard
fun dropTables(vararg tables: Table)

Drop tables for a plugin.

Link copied to clipboard
fun getDatabase(): Database

Get the underlying database instance.

Link copied to clipboard
suspend fun <T> suspendTransaction(block: Transaction.() -> T): T

Execute a suspending transaction. This can be used from coroutine contexts.

Link copied to clipboard
suspend fun <T> suspendTransactionWithResult(block: Transaction.() -> T): Result<T>

Execute a suspending transaction with error handling.

Link copied to clipboard
fun <T> transaction(block: Transaction.() -> T): T

Execute a transaction (basic version).

Link copied to clipboard
fun <T> transactionWithResult(block: Transaction.() -> T): Result<T>

Execute a transaction with error handling.

Link copied to clipboard
fun <T> transactionWithRetry(maxRetries: Int = 3, delayMillis: Long = 100, block: Transaction.() -> T): T

Execute a transaction with retry logic.