English | 简体中文

api-docs / org.ktorm.schema / ColumnDeclaring

ColumnDeclaring

interface ColumnDeclaring<T : Any> (source code)

Common interface of Column and ScalarExpression.

Properties

NameSummary

sqlType

abstract val sqlType: SqlType<T>

The SqlType of this column or expression.

Functions

NameSummary

aliased

abstract fun aliased(
    label: String?
): ColumnDeclaringExpression<T>

Wrap this instance as a ColumnDeclaringExpression.

asExpression

abstract fun asExpression(): ScalarExpression<T>

Convert this instance to a ScalarExpression.

wrapArgument

abstract fun wrapArgument(
    argument: T?
): ArgumentExpression<T>

Wrap the given argument as an ArgumentExpression using the sqlType.

Extension Functions

NameSummary

and


infix fun ColumnDeclaring<Boolean>.and(
    value: Boolean
): BinaryExpression<Boolean>

And operator, translated to the and keyword in SQL.

asc

Order this column or expression in ascending order.

between

infix fun <T : Comparable<T>> ColumnDeclaring<T>.between(
    range: ClosedRange<T>
): BetweenExpression<T>

Between operator, translated to between .. and .. in SQL.

cast

fun <T : Any> ColumnDeclaring<*>.cast(
    sqlType: SqlType<T>
): CastingExpression<T>

Cast the current column or expression to the given SqlType.

containedIn

fun ColumnDeclaring<Cube>.containedIn(
    expr: ColumnDeclaring<Cube>
): CubeExpression<Boolean>

fun ColumnDeclaring<Cube>.containedIn(
    argument: Cube
): CubeExpression<Boolean>

fun ColumnDeclaring<Earth>.containedIn(
    expr: ColumnDeclaring<Cube>
): CubeExpression<Boolean>

fun ColumnDeclaring<Earth>.containedIn(
    argument: Cube
): CubeExpression<Boolean>

Cube contained in operator, translated to the <@ operator in PostgreSQL.


fun ColumnDeclaring<HStore>.containedIn(
    argument: HStore
): HStoreExpression<Boolean>

HStore contained in operator, translated to the <@ operator in PostgreSQL.

contains


fun ColumnDeclaring<Cube>.contains(
    argument: Cube
): CubeExpression<Boolean>


fun ColumnDeclaring<Cube>.contains(
    argument: Earth
): CubeExpression<Boolean>

Cube contains operator, translated to the @> operator in PostgreSQL.


fun ColumnDeclaring<HStore>.contains(
    argument: HStore
): HStoreExpression<Boolean>

HStore contains operator, translated to the @> operator in PostgreSQL.

containsAll


fun ColumnDeclaring<HStore>.containsAll(
    argument: TextArray
): HStoreExpression<Boolean>

HStore contains all keys operator, translated to the ?& operator in PostgreSQL.

containsAny


fun ColumnDeclaring<HStore>.containsAny(
    argument: TextArray
): HStoreExpression<Boolean>

HStore contains any keys operator, translated to the ?| operator in PostgreSQL.

containsKey


fun ColumnDeclaring<HStore>.containsKey(
    argument: String
): HStoreExpression<Boolean>

HStore contains key operator, translated to the ? operator in PostgreSQL.

desc

Order this column or expression in descending order, corresponding to the desc keyword in SQL.

div

infix operator fun <T : Number> ColumnDeclaring<T>.div(
    expr: ColumnDeclaring<T>
): BinaryExpression<T>

infix operator fun <T : Number> ColumnDeclaring<T>.div(
    value: T
): BinaryExpression<T>

Divide operator, translated to / in SQL.

eq

infix fun <T : Any> ColumnDeclaring<T>.eq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Any> ColumnDeclaring<T>.eq(
    value: T
): BinaryExpression<Boolean>

infix fun <T : Any> T.eq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Equal operator, translated to = in SQL.

get


operator fun ColumnDeclaring<HStore>.get(
    argument: String
): HStoreExpression<String>

HStore get value for key operator, translated to the -> operator in PostgreSQL.


operator fun ColumnDeclaring<HStore>.get(
    argument: TextArray
): HStoreExpression<TextArray>

HStore get values for keys operator, translated to the -> operator in PostgreSQL.

greater

infix fun <T : Comparable<T>> ColumnDeclaring<T>.greater(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.greater(
    value: T
): BinaryExpression<Boolean>

Greater operator, translated to > in SQL.

greaterEq

infix fun <T : Comparable<T>> ColumnDeclaring<T>.greaterEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.greaterEq(
    value: T
): BinaryExpression<Boolean>

Greater-eq operator, translated to >= in SQL.

gt

infix fun <T : Comparable<T>> ColumnDeclaring<T>.gt(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.gt(
    value: T
): BinaryExpression<Boolean>

Greater operator, translated to > in SQL.

gte

infix fun <T : Comparable<T>> ColumnDeclaring<T>.gte(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.gte(
    value: T
): BinaryExpression<Boolean>

Greater-eq operator, translated to >= in SQL.

ifNull

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: ColumnDeclaring<T>
): FunctionExpression<T>

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: T?
): FunctionExpression<T>

MySQL ifnull function, translated to ifnull(left, right).

ifNull

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: ColumnDeclaring<T>
): FunctionExpression<T>

fun <T : Any> ColumnDeclaring<T>.ifNull(
    right: T?
): FunctionExpression<T>

SQLite ifnull function, translated to ifnull(left, right).

ilike

infix fun ColumnDeclaring<*>.ilike(
    expr: ColumnDeclaring<String>
): ILikeExpression

infix fun ColumnDeclaring<*>.ilike(
    argument: String
): ILikeExpression

ILike operator, translated to the ilike keyword in PostgreSQL.

inList

fun <T : Any> ColumnDeclaring<T>.inList(
    vararg list: T
): InListExpression<T>

infix fun <T : Any> ColumnDeclaring<T>.inList(
    list: Collection<T>
): InListExpression<T>

infix fun <T : Any> ColumnDeclaring<T>.inList(
    query: Query
): InListExpression<T>

In-list operator, translated to the in keyword in SQL.

instr


fun ColumnDeclaring<String>.instr(
    right: String
): FunctionExpression<Int>

SQLite instr function, translated to instr(left, right).

isNotNull

Check if the current column or expression is not null, translated to is not null in SQL.

isNull

Check if the current column or expression is null, translated to is null in SQL.

jsonExtract

fun <T : Any> ColumnDeclaring<*>.jsonExtract(
    path: String,
    sqlType: SqlType<T> = sqlTypeOf() ?: error("Cannot detect the result's SqlType, please specify manually.")
): FunctionExpression<T>

SQLite json_extract function, translated to json_extract(column, path).

jsonPatch

fun ColumnDeclaring<*>.jsonPatch(
    right: ColumnDeclaring<*>
): FunctionExpression<String>

SQLite json_patch function, translated to json_patch(left, right).

jsonRemove

fun ColumnDeclaring<*>.jsonRemove(
    path: String
): FunctionExpression<String>

SQLite json_remove function, translated to json_remove(column, path).

jsonValid

SQLite json_valid function, translated to json_valid(column).

less

infix fun <T : Comparable<T>> ColumnDeclaring<T>.less(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.less(
    value: T
): BinaryExpression<Boolean>

Less operator, translated to < in SQL.

lessEq

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lessEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lessEq(
    value: T
): BinaryExpression<Boolean>

Less-eq operator, translated to <= in SQL.

like

infix fun ColumnDeclaring<*>.like(
    expr: ColumnDeclaring<String>
): BinaryExpression<Boolean>

infix fun ColumnDeclaring<*>.like(
    value: String
): BinaryExpression<Boolean>

Like operator, translated to the like keyword in SQL.

lt

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lt(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lt(
    value: T
): BinaryExpression<Boolean>

Less operator, translated to < in SQL.

lte

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lte(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Comparable<T>> ColumnDeclaring<T>.lte(
    value: T
): BinaryExpression<Boolean>

Less-eq operator, translated to <= in SQL.

minus

infix operator fun <T : Number> ColumnDeclaring<T>.minus(
    expr: ColumnDeclaring<T>
): BinaryExpression<T>

infix operator fun <T : Number> ColumnDeclaring<T>.minus(
    value: T
): BinaryExpression<T>

Minus operator, translated to - in SQL.

minus

operator fun ColumnDeclaring<HStore>.minus(
    expr: ColumnDeclaring<String>
): HStoreExpression<HStore>

operator fun ColumnDeclaring<HStore>.minus(
    argument: String
): HStoreExpression<HStore>

HStore delete key operator, translated to the - operator in PostgreSQL.


operator fun ColumnDeclaring<HStore>.minus(
    argument: TextArray
): HStoreExpression<HStore>

HStore delete keys operator, translated to the - operator in PostgreSQL.

operator fun ColumnDeclaring<HStore>.minus(
    expr: ColumnDeclaring<HStore>
): HStoreExpression<HStore>

operator fun ColumnDeclaring<HStore>.minus(
    argument: HStore
): HStoreExpression<HStore>

HStore delete matching pairs operator, translated to the - operator in PostgreSQL.

neq

infix fun <T : Any> ColumnDeclaring<T>.neq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Any> ColumnDeclaring<T>.neq(
    value: T
): BinaryExpression<Boolean>

infix fun <T : Any> T.neq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.

not

Negative operator, translated to the not keyword in SQL.

notBetween

infix fun <T : Comparable<T>> ColumnDeclaring<T>.notBetween(
    range: ClosedRange<T>
): BetweenExpression<T>

Not-between operator, translated to not between .. and .. in SQL.

notEq

infix fun <T : Any> ColumnDeclaring<T>.notEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

infix fun <T : Any> ColumnDeclaring<T>.notEq(
    value: T
): BinaryExpression<Boolean>

infix fun <T : Any> T.notEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.

notInList

fun <T : Any> ColumnDeclaring<T>.notInList(
    vararg list: T
): InListExpression<T>

infix fun <T : Any> ColumnDeclaring<T>.notInList(
    list: Collection<T>
): InListExpression<T>

infix fun <T : Any> ColumnDeclaring<T>.notInList(
    query: Query
): InListExpression<T>

Not-in-list operator, translated to the not in keyword in SQL.

notLike

infix fun ColumnDeclaring<*>.notLike(
    expr: ColumnDeclaring<String>
): BinaryExpression<Boolean>

infix fun ColumnDeclaring<*>.notLike(
    value: String
): BinaryExpression<Boolean>

Not like operator, translated to the not like keyword in SQL.

or


infix fun ColumnDeclaring<Boolean>.or(
    value: Boolean
): BinaryExpression<Boolean>

Or operator, translated to the or keyword in SQL.

overlaps


fun ColumnDeclaring<Cube>.overlaps(
    argument: Cube
): CubeExpression<Boolean>

Cube overlap operator, translated to the && operator in PostgreSQL.

plus

infix operator fun <T : Number> ColumnDeclaring<T>.plus(
    expr: ColumnDeclaring<T>
): BinaryExpression<T>

infix operator fun <T : Number> ColumnDeclaring<T>.plus(
    value: T
): BinaryExpression<T>

Plus operator, translated to + in SQL.

plus

operator fun ColumnDeclaring<HStore>.plus(
    expr: ColumnDeclaring<HStore>
): HStoreExpression<HStore>

operator fun ColumnDeclaring<HStore>.plus(
    argument: HStore
): HStoreExpression<HStore>

HStore concatenate operator, translated to the || operator in PostgreSQL.

rem

infix operator fun <T : Number> ColumnDeclaring<T>.rem(
    expr: ColumnDeclaring<T>
): BinaryExpression<T>

infix operator fun <T : Number> ColumnDeclaring<T>.rem(
    value: T
): BinaryExpression<T>

Mod operator, translated to % in SQL.

replace

fun ColumnDeclaring<String>.replace(
    oldValue: String,
    newValue: String
): FunctionExpression<String>

MySQL replace function, translated to replace(str, oldValue, newValue).

replace

fun ColumnDeclaring<String>.replace(
    oldValue: String,
    newValue: String
): FunctionExpression<String>

SQLite replace function, translated to replace(str, oldValue, newValue).

times

infix operator fun <T : Number> ColumnDeclaring<T>.times(
    expr: ColumnDeclaring<T>
): BinaryExpression<T>

infix operator fun <T : Number> ColumnDeclaring<T>.times(
    value: T
): BinaryExpression<T>

Multiply operator, translated to * in SQL.

toDouble

Cast the current column or expression’s type to Double.

toFloat

Cast the current column or expression’s type to Float.

toInt


Cast the current column or expression’s type to Int.

toLong

Cast the current column or expression’s type to Long.

toLowerCase

MySQL lower function, translated to lower(str).

toLowerCase

SQLite lower function, translated to lower(str).

toShort

Cast the current column or expression’s type to Short.

toUpperCase

MySQL upper function, translated to upper(str).

toUpperCase

SQLite upper function, translated to upper(str).

unaryMinus

operator fun <T : Number> ColumnDeclaring<T>.unaryMinus(): UnaryExpression<T>

Unary minus operator, translated to - in SQL.

unaryPlus

operator fun <T : Number> ColumnDeclaring<T>.unaryPlus(): UnaryExpression<T>

Unary plus operator, translated to + in SQL.

xor


infix fun ColumnDeclaring<Boolean>.xor(
    value: Boolean
): BinaryExpression<Boolean>

Xor operator, translated to the xor keyword in SQL.

Inheritors

NameSummary

Column

data class Column<T : Any> : ColumnDeclaring<T>

Represents database columns.

ScalarExpression

abstract class ScalarExpression<T : Any> : 
    SqlExpression,
    ColumnDeclaring<T>

Base class of scalar expressions. An expression is “scalar” if it has a return value (eg. a + 1).