English | 简体中文

api-docs / org.ktorm.dsl / CaseWhen

CaseWhen

data class CaseWhen<T : Any, R : Any> (source code)

Helper class used to build case-when SQL DSL. See CaseWhenExpression.

Constructors

NameSummary

<init>

CaseWhen(
    operand: ColumnDeclaring<T>?,
    whenClauses: List<Pair<ColumnDeclaring<T>, ColumnDeclaring<R>>> = emptyList(),
    elseClause: ColumnDeclaring<R>? = null)

Helper class used to build case-when SQL DSL. See CaseWhenExpression.

Properties

NameSummary

elseClause

val elseClause: ColumnDeclaring<R>?

operand

val operand: ColumnDeclaring<T>?

whenClauses

val whenClauses: List<Pair<ColumnDeclaring<T>, ColumnDeclaring<R>>>

Extension Functions

NameSummary

ELSE

fun <T : Any, R : Any> CaseWhen<T, R>.ELSE(
    result: ColumnDeclaring<R>
): CaseWhen<T, R>

fun <T : Any, R : Any> CaseWhen<T, R>.ELSE(
    result: R,
    sqlType: SqlType<R> = SqlType.of() ?: error("Cannot detect the argument's SqlType, please specify manually.")
): CaseWhen<T, R>

Specifies the else clause for the case-when DSL.

END

fun <R : Any> CaseWhen<*, R>.END(): CaseWhenExpression<R>

Finishes the case-when DSL and returns a CaseWhenExpression.

eq

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

Equal operator, translated to = in SQL.

neq

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

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

notEq

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

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

WHEN

fun <T : Any, R : Any> CaseWhen<T, R>.WHEN(
    condition: ColumnDeclaring<T>
): WhenContinuation<T, R>

fun <T : Any, R : Any> CaseWhen<T, R>.WHEN(
    condition: T,
    sqlType: SqlType<T> = SqlType.of() ?: error("Cannot detect the argument's SqlType, please specify manually.")
): WhenContinuation<T, R>

Starts a when clause with the given condition.