Package-level declarations

Types

Link copied to clipboard
abstract class BaseTable<E : Any>(tableName: String, alias: String? = null, catalog: String? = null, schema: String? = null, entityClass: KClass<E>? = null) : TypeReference<E>

Base class of Ktorm's table objects, represents relational tables in the database.

Link copied to clipboard

SqlType implementation represents blob SQL type.

Link copied to clipboard

SqlType implementation represents boolean SQL type.

Link copied to clipboard

SqlType implementation represents bytes SQL type.

Link copied to clipboard
data class Column<T : Any>(val table: BaseTable<*>, val name: String, val binding: ColumnBinding? = null, val extraBindings: List<ColumnBinding> = emptyList(), val sqlType: SqlType<T>) : ColumnDeclaring<T>

Represents database columns.

Link copied to clipboard
sealed class ColumnBinding

Base class of column bindings. A column might be bound to a simple property, nested properties, or a reference to another table.

Link copied to clipboard
interface ColumnDeclaring<T : Any>

Common interface of Column and ScalarExpression.

Link copied to clipboard

SqlType implementation represents date SQL type.

Link copied to clipboard

SqlType implementation represents decimal SQL type.

Link copied to clipboard

SqlType implementation represents double SQL type.

Link copied to clipboard
class EnumSqlType<C : Enum<C>>(val enumClass: Class<C>) : SqlType<C>

SqlType implementation that saves enums as strings.

Link copied to clipboard

SqlType implementation represents float SQL type.

Link copied to clipboard

SqlType implementation represents timestamp SQL type.

Link copied to clipboard

SqlType implementation represents int SQL type.

Link copied to clipboard

SqlType implementation represents date SQL type.

Link copied to clipboard

SqlType implementation represents datetime SQL type.

Link copied to clipboard

SqlType implementation represents time SQL type.

Link copied to clipboard

SqlType implementation represents long SQL type.

Link copied to clipboard

SqlType implementation used to save MonthDay instances, formatting them to strings with pattern MM-dd.

Link copied to clipboard
data class NestedBinding(val properties: List<KProperty1<*, *>>) : ColumnBinding

Bind the column to nested properties, e.g. employee.manager.department.id.

Link copied to clipboard
data class ReferenceBinding(val referenceTable: BaseTable<*>, val onProperty: KProperty1<*, *>) : ColumnBinding

Bind the column to a reference table, equivalent to a foreign key in relational databases. Entity sequence APIs would automatically left-join all references (recursively) by default.

Link copied to clipboard

SqlType implementation represents smallint SQL type.

Link copied to clipboard
abstract class SqlType<T : Any>(val typeCode: Int, val typeName: String)

Abstraction of SQL data types.

Link copied to clipboard
open class Table<E : Entity<E>>(tableName: String, alias: String? = null, catalog: String? = null, schema: String? = null, entityClass: KClass<E>? = null) : BaseTable<E>

Base class of Ktorm's table objects. This class extends from BaseTable, additionally providing a binding mechanism with Entity interfaces based on functions such as bindTo, references.

Link copied to clipboard

SqlType implementation represents text SQL type.

Link copied to clipboard

SqlType implementation represents time SQL type.

Link copied to clipboard

SqlType implementation represents timestamp SQL type.

Link copied to clipboard
abstract class TypeReference<T>

Base class used to obtain full generic type information by subclassing.

Link copied to clipboard

SqlType implementation represents uuid SQL type.

Link copied to clipboard

SqlType implementation represents varchar SQL type.

Link copied to clipboard

SqlType implementation used to save YearMonth instances, formatting them to strings with pattern yyyy-MM.

Link copied to clipboard

SqlType implementation used to save Year instances as integers.

Functions

Link copied to clipboard

Define a column typed of BlobSqlType.

Link copied to clipboard

Define a column typed of BooleanSqlType.

Link copied to clipboard

Define a column typed of BytesSqlType.

Link copied to clipboard

Define a column typed of LocalDateSqlType.

Link copied to clipboard

Define a column typed of LocalDateTimeSqlType.

Link copied to clipboard

Define a column typed of DecimalSqlType.

Link copied to clipboard

Define a column typed of DoubleSqlType.

Link copied to clipboard
inline fun <C : Enum<C>> BaseTable<*>.enum(name: String): Column<C>

Define a column typed of EnumSqlType.

Link copied to clipboard

Define a column typed of FloatSqlType.

Link copied to clipboard
fun BaseTable<*>.int(name: String): Column<Int>

Define a column typed of IntSqlType.

Link copied to clipboard

Define a column typed of DateSqlType.

Link copied to clipboard

Define a column typed of TimeSqlType.

Link copied to clipboard

Define a column typed of TimestampSqlType.

Link copied to clipboard
inline fun <T> kotlinTypeOf(): KType

Obtain the full generic type information of the reified type argument T, usage: kotlinTypeOf<List<String>>().

Link copied to clipboard
fun BaseTable<*>.long(name: String): Column<Long>

Define a column typed of LongSqlType.

Link copied to clipboard

Define a column typed of MonthDaySqlType, instances of MonthDay are saved as strings in format MM-dd.

Link copied to clipboard

Define a column typed of ShortSqlType.

Link copied to clipboard

Define a column typed of TextSqlType.

Link copied to clipboard

Define a column typed of LocalTimeSqlType.

Link copied to clipboard

Define a column typed of InstantSqlType.

Link copied to clipboard
inline fun <T> typeOf(): Type

Obtain the full generic type information of the reified type argument T, usage: typeOf<List<String>>().

Link copied to clipboard
inline fun <T> typeRef(): TypeReference<T>

Create a TypeReference object which references the reified type argument T.

Link copied to clipboard
fun BaseTable<*>.uuid(name: String): Column<UUID>

Define a column typed of UuidSqlType.

Link copied to clipboard

Define a column typed of VarcharSqlType.

Link copied to clipboard
fun BaseTable<*>.year(name: String): Column<Year>

Define a column typed of YearSqlType, instances of Year are saved as integers.

Link copied to clipboard

Define a column typed of YearMonthSqlType, instances of YearMonth are saved as strings in format yyyy-MM.