English | 简体中文

api-docs / org.ktorm.expression / SelectExpression

SelectExpression

data class SelectExpression : QueryExpression (source code)

Select expression, represents a select statement of SQL.

Constructors

NameSummary

<init>

SelectExpression(
    columns: List<ColumnDeclaringExpression<*>> = emptyList(),
    from: QuerySourceExpression,
    where: ScalarExpression<Boolean>? = null,
    groupBy: List<ScalarExpression<*>> = emptyList(),
    having: ScalarExpression<Boolean>? = null,
    isDistinct: Boolean = false,
    orderBy: List<OrderByExpression> = emptyList(),
    offset: Int? = null,
    limit: Int? = null,
    tableAlias: String? = null,
    extraProperties: Map<String, Any> = emptyMap())

Select expression, represents a select statement of SQL.

Properties

NameSummary

columns

the selected column declarations, empty means select *.

extraProperties

val extraProperties: Map<String, Any>

Extra properties of this expression, maybe useful in SqlFormatter to generate some special SQLs.

from

the query’s source, represents the from clause of SQL.

groupBy

val groupBy: List<ScalarExpression<*>>

the grouping conditions, represents the group by clause of SQL.

having

the having condition, represents the having clause of SQL.

isDistinct

val isDistinct: Boolean

mark if this query is distinct, true means the SQL is select distinct ....

limit

val limit: Int?

max record numbers returned by the query.

offset

val offset: Int?

the offset of the first returned record.

orderBy

val orderBy: List<OrderByExpression>

a list of order-by expressions, used in the order by clause of a query.

tableAlias

val tableAlias: String?

the alias when this query is nested in another query’s source, eg. select * from (...) alias.

where

the filter condition, represents the where clause of SQL.

Inherited Properties

NameSummary

isLeafNode

val isLeafNode: Boolean

Check if this expression is a leaf node in expression trees.

Extension Functions

NameSummary

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.