Package-level declarations

Types

Link copied to clipboard
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

Creates a SQLite driver for JVM (desktop / server) targets.

Link copied to clipboard
class KilnTransactionContext(dirtyTables: MutableSet<String> = mutableSetOf()) : CoroutineContext.Element

Coroutine context element that carries the set of table names written during an active withTransaction block. Repository methods detect this via kotlin.coroutines.coroutineContext and defer SqlDriver.notifyListeners until the transaction commits successfully.

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: SqlDriver)

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
fun SqlPreparedStatement.bindArg(index: Int, arg: SqlArg)
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 SqlDriver.notifyOrDefer(tableName: String)

If the current coroutine is executing inside a withTransaction block, records tableName as dirty so the notification is deferred to after commit. Outside a transaction, calls SqlDriver.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: SqlDriver, 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 SqlDriver.withTransaction(context: CoroutineContext = Dispatchers.Default, block: suspend () -> Unit)

Executes block inside a single SQLite transaction.