Package-level declarations

Types

Link copied to clipboard
data class And<T : Any>(left: Where<T>, right: Where<T>) : Where<T>

Equivalent to AND in SQL

Link copied to clipboard
data class CaseOrderBy<T : Any> : OrderBy<T>
Link copied to clipboard
data class CaseWhen<T : Any>

A SQL CASE … WHEN … END value expression. Build via case on a sealed parent property or KClass. Use as the LHS of a comparison operator (eq, gt, …) to produce a Where, or pass to OrderBy to drive ordering.

Link copied to clipboard
Link copied to clipboard
class CaseWhere<T : Any> : Where<T>

A SQL CASE WHEN <disc> = ? THEN <pred> [...] [ELSE <pred>] END expression usable as a top-level Where.

Link copied to clipboard
class CaseWhereBranch<T : Any, V : T>

Typed scope inside a whenIs<V> { ... } branch.

Link copied to clipboard
Link copied to clipboard

Builder for predicate-dispatch CASE/WHEN where the discriminator is an arbitrary field (enum, string, etc.). Branches are matched against the value of discriminatorPath for equality.

Link copied to clipboard
class EntityQueries(sqlDriver: SqlDriver) : TransacterImpl
Link copied to clipboard
data class Eq<T : Any, V>(builder: JsonPathBuilder<T>, value: V?) : Where<T>

Equivalent to = in SQL

Link copied to clipboard
data class GreaterThan<T : Any, V>(builder: JsonPathBuilder<T>, value: V?) : Where<T>

Equivalent to > in SQL

Link copied to clipboard
data class In<T : Any, V>(builder: JsonPathBuilder<T>, value: Collection<V>) : Where<T>

Equivalent to IN in SQL

Link copied to clipboard

Create a Path builder using one of the manu reified methods.

Link copied to clipboard
class JsonPathNode<R, V>

Represents a path in a JSON object, using limited reflection and descriptors to build the path.

Link copied to clipboard
data class JsonPathOrderBy<T : Any> : OrderBy<T>
Link copied to clipboard
open class KeyValueStorage<T : Any>(entityName: String, entityQueries: EntityQueries, metadataQueries: MetadataQueries, scope: CoroutineScope, type: KType, serializer: SqkonSerializer = KotlinSqkonSerializer(), config: KeyValueStorage.Config = Config(), readDispatcher: CoroutineDispatcher, writeDispatcher: CoroutineDispatcher, transacter: SqkonTransacter) : Transacter

Base interaction to the database.

Link copied to clipboard
data class LessThan<T : Any, V>(builder: JsonPathBuilder<T>, value: V?) : Where<T>

Equivalent to < in SQL

Link copied to clipboard
data class Like<T : Any>(builder: JsonPathBuilder<T>, value: String?) : Where<T>

Equivalent to LIKE in SQL

Link copied to clipboard
data class Not<T : Any>(where: Where<T>) : Where<T>

Equivalent to NOT ($where) in SQL

Link copied to clipboard
data class NotEq<T : Any, V>(builder: JsonPathBuilder<T>, value: V?) : Where<T>

Equivalent to != in SQL

Link copied to clipboard
data class NotIn<T : Any, V>(builder: JsonPathBuilder<T>, value: Collection<V>) : Where<T>
Link copied to clipboard
data class Or<T : Any>(left: Where<T>, right: Where<T>) : Where<T>

Equivalent to OR in SQL

Link copied to clipboard
sealed class OrderBy<T : Any>
Link copied to clipboard
Link copied to clipboard
data class ResultRow<T : Any>(val addedAt: Instant, val updatedAt: Instant, val expiresAt: Instant?, val readAt: Instant?, val writeAt: Instant, val value: T)
Link copied to clipboard
class Sqkon

Main entry point for Sqkon.

Link copied to clipboard

Read/write coroutine dispatcher bundle for Sqkon.

Link copied to clipboard
actual typealias SqlException = SQLException
expect class SqlException : Exception
actual class SqlException(message: String? = null, cause: Throwable? = null) : Exception
actual typealias SqlException = SQLException
Link copied to clipboard
data class SqlQuery(val from: String? = null, val where: String? = null, val parameters: Int = 0, val bindArgs: AutoIncrementSqlPreparedStatement.() -> Unit = {}, val orderBy: String? = null)
Link copied to clipboard
data class SqlValueFragment(val sql: String, val parameters: Int, val bindArgs: AutoIncrementSqlPreparedStatement.() -> Unit)
Link copied to clipboard
abstract class Where<T : Any>

Functions

Link copied to clipboard
infix fun <T : Any> Where<T>.and(other: Where<T>): Where<T>

Equivalent to AND in SQL

Link copied to clipboard
inline fun <R : Any, V> KProperty1<R, V>.builder(serialName: String? = null, block: JsonPathNode<R, V>.() -> Unit = {}): JsonPathBuilder<R>
Link copied to clipboard
inline fun <R : Any, V> KProperty1<R, Collection<V>>.builderFromList(block: JsonPathNode<out R, V>.() -> Unit = {}): JsonPathBuilder<R>
Link copied to clipboard
inline fun <R : Any> KClass<R>.case(block: CaseWhenBuilder<R>.() -> Unit): CaseWhen<R>

CASE WHEN expression rooted at the entity itself when it is a sealed type (e.g. KeyValueStorage<BaseSealed>). Discriminator path is $[0], payload is under $[1].

inline fun <T : Any, S : Any> KProperty1<T, S>.case(block: CaseWhenBuilder<T>.() -> Unit): CaseWhen<T>

CASE WHEN expression rooted at a sealed parent property (e.g. MyEntity::status). The variant discriminator is read from <parentPath>[0]; payload paths sit under [1].

Link copied to clipboard
inline fun <T : Any, K> caseWhere(discriminator: KProperty1<T, K>, block: CaseWhereOnBuilder<T, K>.() -> Unit): Where<T>

Predicate-dispatch CASE/WHEN where the discriminator is an arbitrary field (enum, string, etc.). Compile safety: the whenEq value must match the discriminator field's type.

Link copied to clipboard
inline fun <R : Any> KClass<R>.caseWhere(block: CaseWhereBuilder<R>.() -> Unit): Where<R>

Predicate-dispatch CASE/WHEN rooted at the entity itself when it is a sealed type. Discriminator at $[0], payload under $[1].

Link copied to clipboard
infix fun <T : Any, V> CaseWhen<T>.eq(value: V?): Where<T>

infix fun <T : Any, V> JsonPathBuilder<T>.eq(value: V?): Eq<T, V>
infix inline fun <T : Any, V, VALUE> KProperty1<T, V>.eq(value: VALUE?): Eq<T, VALUE>

Equivalent to = in SQL

Link copied to clipboard
infix fun <T : Any, V> CaseWhen<T>.gt(value: V?): Where<T>

infix fun <T : Any, V> JsonPathBuilder<T>.gt(value: V?): GreaterThan<T, V>
infix inline fun <T : Any, V, VALUE> KProperty1<T, V>.gt(value: VALUE?): GreaterThan<T, VALUE>

Equivalent to > in SQL

Link copied to clipboard
infix fun <T : Any, V> JsonPathBuilder<T>.inList(value: Collection<V>): In<T, V>
infix inline fun <T : Any, V, C> KProperty1<T, V>.inList(value: Collection<C>): In<T, C>

Equivalent to IN in SQL

Link copied to clipboard
fun <T : Any> CaseWhen<T>.isNotNull(): Where<T>
Link copied to clipboard
fun <T : Any> CaseWhen<T>.isNull(): Where<T>
Link copied to clipboard
inline fun <T : Any> keyValueStorage(entityName: String, entityQueries: EntityQueries, metadataQueries: MetadataQueries, scope: CoroutineScope, serializer: SqkonSerializer = KotlinSqkonSerializer(), config: KeyValueStorage.Config = KeyValueStorage.Config(), readDispatcher: CoroutineDispatcher = defaultSqkonDispatchers.read, writeDispatcher: CoroutineDispatcher = defaultSqkonDispatchers.write, transactor: SqkonTransacter = SqkonTransacter(entityQueries.sqlDriver)): KeyValueStorage<T>
Link copied to clipboard
infix fun <T : Any> JsonPathBuilder<T>.like(value: String?): Like<T>
infix inline fun <T : Any, V> KProperty1<T, V>.like(value: String?): Like<T>

Equivalent to LIKE in SQL

Link copied to clipboard
infix fun <T : Any, V> CaseWhen<T>.lt(value: V?): Where<T>

infix fun <T : Any, V> JsonPathBuilder<T>.lt(value: V?): LessThan<T, V>
infix inline fun <T : Any, V, VALUE> KProperty1<T, V>.lt(value: VALUE?): LessThan<T, VALUE>

Equivalent to < in SQL

Link copied to clipboard
infix fun <T : Any, V> CaseWhen<T>.neq(value: V?): Where<T>

infix fun <T : Any, V> JsonPathBuilder<T>.neq(value: V?): NotEq<T, V>
infix inline fun <T : Any, V, VALUE> KProperty1<T, V>.neq(value: VALUE?): NotEq<T, VALUE>

Equivalent to != in SQL

Link copied to clipboard
fun <T : Any> not(where: Where<T>): Not<T>

Equivalent to NOT ($where) in SQL

Link copied to clipboard
infix fun <T : Any, V> JsonPathBuilder<T>.notInList(value: Collection<V>): NotIn<T, V>
inline fun <T : Any, V, C> KProperty1<T, V>.notInList(value: Collection<C>): NotIn<T, C>

Equivalent to NOT IN in SQL

Link copied to clipboard
infix fun <T : Any> Where<T>.or(other: Where<T>): Where<T>

Equivalent to OR in SQL

Link copied to clipboard
fun <T : Any> OrderBy(case: CaseWhen<T>, direction: OrderDirection? = null): OrderBy<T>
fun <T : Any> OrderBy(builder: JsonPathBuilder<T>, direction: OrderDirection? = null): OrderBy<T>
inline fun <T : Any, V> OrderBy(property: KProperty1<T, V>, direction: OrderDirection? = null): OrderBy<T>
Link copied to clipboard
fun Sqkon(context: Context, scope: CoroutineScope, json: Json = SqkonJson { }, inMemory: Boolean = false, config: KeyValueStorage.Config = KeyValueStorage.Config()): Sqkon

fun Sqkon(context: Context, scope: CoroutineScope, json: Json = SqkonJson { }, dbFileName: String? = "sqkon.db", config: KeyValueStorage.Config = KeyValueStorage.Config(), dispatchers: SqkonDispatchers = defaultSqkonDispatchers): Sqkon

Main entry point for Sqkon on Android

fun Sqkon(scope: CoroutineScope, json: Json = SqkonJson { }, type: AndroidxSqliteDatabaseType = AndroidxSqliteDatabaseType.Memory, config: KeyValueStorage.Config = KeyValueStorage.Config(), dispatchers: SqkonDispatchers = defaultSqkonDispatchers): Sqkon
Link copied to clipboard
@JvmName(name = "thenList")
inline fun <R : Any, V, V2> KProperty1<R, V>.then(property: KProperty1<out V, Collection<V2>>, block: JsonPathNode<out V, V2>.() -> Unit = {}): JsonPathBuilder<R>
inline fun <R : Any, V, V1 : V, V2> KProperty1<R, V>.then(property: KProperty1<V1, V2>, fromSerialName: String? = null, thenSerialName: String? = null, block: JsonPathNode<V1, V2>.() -> Unit = {}): JsonPathBuilder<R>
@JvmName(name = "thenFromList")
inline fun <R : Any, V, V1 : V, V2> KProperty1<R, Collection<V>>.then(property: KProperty1<V1, V2>, fromSerialName: String? = null, thenSerialName: String? = null, block: JsonPathNode<V1, V2>.() -> Unit = {}): JsonPathBuilder<R>
Link copied to clipboard
Link copied to clipboard
inline fun <T : Any, V : T, X> CaseWhereBranch<T, V>.with(prop: KProperty1<V, X>): JsonPathBuilder<T>

Reach into a property of the variant V from inside a whenIs<V> { ... } scope, producing a JsonPathBuilder rooted at the variant payload (e.g. $[1].dueAt for a sealed-root entity).

inline fun <T : Any, V : T, X> CaseWhereBranch<T, V>.with(prop: KProperty1<V, X>, noinline block: JsonPathNode<T, X>.() -> Unit): JsonPathBuilder<T>

Nested-path variant — chains then onto the variant property path.

inline fun <R : Any, R1 : R, V> KClass<R>.with(property: KProperty1<R1, V>, serialName: String? = null, block: JsonPathNode<R, V>.() -> Unit = {}): JsonPathBuilder<R>
Link copied to clipboard
inline fun <R : Any, V> KClass<R>.withList(property: KProperty1<R, Collection<V>>, serialName: String? = null, block: JsonPathNode<R, V>.() -> Unit = {}): JsonPathBuilder<R>