Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
abstract class BaseKilnDriver : KilnDriver
Link copied to clipboard
class Column<T>(val name: String, val toArg: (T) -> SqlArg)

A typed reference to one table column. Instances are generated — do not construct by hand.

Link copied to clipboard
data class ColumnDef(val name: String, val type: String, val nullable: Boolean, val defaultValue: String, val migrateFrom: String = "", val isPrimaryKey: Boolean = false, val autoIncrement: Boolean = false, val isUnique: Boolean = false)

Full description of one expected column, generated by the processor into each repository's createTable() so SchemaMigrator can diff and migrate automatically.

Link copied to clipboard
interface CrudRepository<T, ID>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface KilnCursor
Link copied to clipboard
Link copied to clipboard
fun interface KilnListener
Link copied to clipboard
Link copied to clipboard
interface KilnTransaction
Link copied to clipboard
enum Order : Enum<Order>
Link copied to clipboard
data class OrderSpec(val columnName: String, val direction: Order)
Link copied to clipboard
class Predicate

A composed WHERE fragment plus its bound arguments.

Link copied to clipboard
class SchemaMigrator(driver: KilnDriver)

Automatic schema migration — called inside every generated createTable().

Link copied to clipboard
sealed interface SqlArg

A bound query argument, tagged with how it must be bound to the statement.

Functions

Link copied to clipboard
fun <T> Column<T>.asc(): OrderSpec
Link copied to clipboard
fun <T> Column<T>.between(low: T, high: T): Predicate
Link copied to clipboard
Link copied to clipboard
fun buildOrderSuffix(orderBy: List<OrderSpec>, limit: Long?, offset: Long?): String

Builds the ORDER BY / LIMIT / OFFSET suffix appended to WHERE queries. Used by generated code.

Link copied to clipboard
fun <T> Column<T>.desc(): OrderSpec
Link copied to clipboard
infix fun <T> Column<T>.eq(value: T): Predicate
Link copied to clipboard
infix fun <T> Column<T>.gt(value: T): Predicate
Link copied to clipboard
infix fun <T> Column<T>.gte(value: T): Predicate
Link copied to clipboard
infix fun <T> Column<T>.inList(values: Collection<T>): Predicate
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
infix fun Column<out String?>.like(pattern: String): Predicate

SQL LIKE — use % and _ wildcards. Works on String and String? columns.

Link copied to clipboard
infix fun <T> Column<T>.lt(value: T): Predicate
Link copied to clipboard
infix fun <T> Column<T>.lte(value: T): Predicate
Link copied to clipboard
infix fun <T> Column<T>.neq(value: T): Predicate
Link copied to clipboard
fun not(predicate: Predicate): Predicate
Link copied to clipboard
suspend fun KilnDriver.notifyOrDefer(tableName: String)

Inside a transaction, records tableName as dirty so its notification is sent once, after the outermost commit — or not at all if the transaction rolls back. Outside a transaction, calls KilnDriver.notifyListeners immediately (preserving the existing per-operation behaviour).

Link copied to clipboard
infix fun <T> Column<T>.notInList(values: Collection<T>): Predicate
Link copied to clipboard
fun <T> observeQuery(driver: KilnDriver, tableName: String, context: CoroutineContext, query: () -> T): Flow<T>

Runs query once immediately, then again every time the driver is notified that tableName changed (generated repositories call notifyListeners after each write).

Link copied to clipboard
suspend fun KilnDriver.withTransaction(context: CoroutineContext = Dispatchers.Default, block: suspend () -> Unit)

Executes block inside a single SQLite transaction.

Link copied to clipboard
suspend fun <T> KilnDriver.withTransactionAwareContext(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T

Runs block like withContext(context, block), unless a transaction is open: