English | 简体中文

api-docs / org.ktorm.dsl / QuerySource

QuerySource

data class QuerySource (source code)

Represents a query source, used in the from clause of a query.

Since
2.7

Constructors

NameSummary

<init>

QuerySource(
    database: Database,
    sourceTable: BaseTable<*>,
    expression: QuerySourceExpression)

Represents a query source, used in the from clause of a query.

Properties

NameSummary

database

val database: Database

the Database instance that the query is running on.

expression

val expression: QuerySourceExpression

the underlying SQL expression.

sourceTable

val sourceTable: BaseTable<*>

the origin source table.

Extension Functions

NameSummary

crossJoin

fun QuerySource.crossJoin(
    right: BaseTable<*>,
    on: ColumnDeclaring<Boolean>? = null
): QuerySource

Perform a cross join and return a new QuerySource, translated to cross join in SQL.

eq

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

Equal operator, translated to = in SQL.

fullJoin

fun QuerySource.fullJoin(
    right: BaseTable<*>,
    on: ColumnDeclaring<Boolean>? = null
): QuerySource

Perform a full join and return a new QuerySource, translated to full join in SQL.

innerJoin

fun QuerySource.innerJoin(
    right: BaseTable<*>,
    on: ColumnDeclaring<Boolean>? = null
): QuerySource

Perform an inner join and return a new QuerySource, translated to inner join in SQL.

joinReferencesAndSelect

fun QuerySource.joinReferencesAndSelect(): Query

Return a new-created Query object, left joining all the reference tables, and selecting all columns of them.

leftJoin

fun QuerySource.leftJoin(
    right: BaseTable<*>,
    on: ColumnDeclaring<Boolean>? = null
): QuerySource

Perform a left join and return a new QuerySource, translated to left join in SQL.

naturalJoin

fun QuerySource.naturalJoin(right: BaseTable<*>): QuerySource

Join the right table and return a new QuerySource, translated to natural join 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.

rightJoin

fun QuerySource.rightJoin(
    right: BaseTable<*>,
    on: ColumnDeclaring<Boolean>? = null
): QuerySource

Perform a right join and return a new QuerySource, translated to right join in SQL.

select

fun QuerySource.select(
    columns: Collection<ColumnDeclaring<*>>
): Query

fun QuerySource.select(
    vararg columns: ColumnDeclaring<*>
): Query

Create a query object, selecting the specific columns or expressions from this QuerySource.

selectDistinct

fun QuerySource.selectDistinct(
    columns: Collection<ColumnDeclaring<*>>
): Query

fun QuerySource.selectDistinct(
    vararg columns: ColumnDeclaring<*>
): Query

Create a query object, selecting the specific columns or expressions from this QuerySource distinctly.