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

Join the right table and return a new QuerySource, translated to cross join in SQL.

innerJoin

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

Join the right table 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

Join the right table 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.

rightJoin

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

Join the right table 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.