Package org.ktorm.dsl
Constructs strong-typed SQL DSL.
Types
Name | Summary |
---|---|
open class AssignmentsBuilder Base class of DSL builders, provide basic functions used to build assignments for insert or update DSL. | |
class BatchInsertStatementBuilder<T : BaseTable<*>> DSL builder for batch insert statements. | |
class BatchUpdateStatementBuilder<T : BaseTable<*>> DSL builder for batch update statements. | |
class Query Query is an abstraction of query operations and the core class of Ktorm’s query DSL. | |
class QueryRowSet : CachedRowSet Special implementation of ResultSet, used to hold the Query results for Ktorm. | |
data class QuerySource Represents a query source, used in the | |
class UpdateStatementBuilder : AssignmentsBuilder DSL builder for update statements. |
Annotations
Name | Summary |
---|---|
annotation class KtormDsl Marker annotation for Ktorm DSL builder classes. |
Extensions for External Classes
Name | Summary |
---|---|
Functions
Name | Summary |
---|---|
infix fun ColumnDeclaring<Boolean>.and( infix fun ColumnDeclaring<Boolean>.and( And operator, translated to the | |
fun ColumnDeclaring<*>.asc(): OrderByExpression Order this column or expression in ascending order. | |
fun Query.asIterable(): Iterable<QueryRowSet> Wrap this query as Iterable. | |
Return a Map containing key-value pairs provided by transform function applied to rows of the query. | |
fun <K, V> Query.associateBy( Return a Map containing the values provided by valueTransform and indexed by keySelector functions applied to | |
fun <K, V, M : MutableMap<in K, in V>> Query.associateByTo( Populate and return the destination mutable map with key-value pairs, where key is provided by the keySelector | |
fun <K, V, M : MutableMap<in K, in V>> Query.associateTo( Populate and return the destination mutable map with key-value pairs provided by transform function applied to | |
fun <C : Number> avg( The avg function, translated to | |
fun <C : Number> avgDistinct( The avg function with distinct, translated to | |
fun <T : BaseTable<*>> Database.batchInsert( Construct insert expressions in the given closure, then batch execute them and return the effected | |
fun <T : BaseTable<*>> Database.batchUpdate( Construct update expressions in the given closure, then batch execute them and return the effected | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.between( Between operator, translated to | |
fun <T : Any> ColumnDeclaring<*>.cast( Cast the current column or expression to the given SqlType. | |
fun count( The count function, translated to | |
fun countDistinct( The count function with distinct, translated to | |
fun QuerySource.crossJoin( Join the right table and return a new QuerySource, translated to | |
Delete the records in the table that matches the given predicate. | |
Delete all the records in the table. | |
fun ColumnDeclaring<*>.desc(): OrderByExpression Order this column or expression in descending order, corresponding to the | |
infix operator fun <T : Number> ColumnDeclaring<T>.div( infix operator fun <T : Number> ColumnDeclaring<T>.div( infix operator fun <T : Number> T.div( Divide operator, translated to | |
infix fun <T : Any> ColumnDeclaring<T>.eq( infix fun <T : Any> ColumnDeclaring<T>.eq( Equal operator, translated to | |
fun exists(query: Query): ExistsExpression Check if the given query has at least one result, translated to the | |
Return a single list of all elements yielded from results of transform function being invoked on each row | |
Return a single list of all elements yielded from results of transform function being invoked on each row | |
fun <R, C : MutableCollection<in R>> Query.flatMapIndexedTo( Append all elements yielded from results of transform function being invoked on each row and its index | |
fun <R, C : MutableCollection<in R>> Query.flatMapTo( Append all elements yielded from results of transform function being invoked on each row of the query, | |
Accumulate value starting with initial value and applying operation to current accumulator value and each row. | |
Accumulate value starting with initial value and applying operation to current accumulator value and each row | |
fun Query.forEach(action: (row: QueryRowSet) -> Unit): Unit Perform the given action on each row of the query. | |
fun Query.forEachIndexed( Perform the given action on each row of the query, providing sequential index with the row. | |
Indicate that this query should aquire the record-lock, the generated SQL would be | |
fun Database.from(table: BaseTable<*>): QuerySource Wrap the specific table as a QuerySource. | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.greater( infix fun <T : Comparable<T>> ColumnDeclaring<T>.greater( infix fun <T : Comparable<T>> T.greater( Greater operator, translated to | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.greaterEq( infix fun <T : Comparable<T>> ColumnDeclaring<T>.greaterEq( infix fun <T : Comparable<T>> T.greaterEq( Greater-eq operator, translated to | |
fun Query.groupBy( fun Query.groupBy(vararg columns: ColumnDeclaring<*>): Query Specify the | |
fun Query.having(condition: ColumnDeclaring<Boolean>): Query Specify the fun Query.having( Specify the | |
fun <T : Any> ColumnDeclaring<T>.inList( infix fun <T : Any> ColumnDeclaring<T>.inList( infix fun <T : Any> ColumnDeclaring<T>.inList( In-list operator, translated to the | |
fun QuerySource.innerJoin( Join the right table and return a new QuerySource, translated to | |
Construct an insert expression in the given closure, then execute it and return the effected row count. | |
fun <T : BaseTable<*>> Database.insertAndGenerateKey( Construct an insert expression in the given closure, then execute it and return the auto-generated key. | |
Insert the current Query‘s results into the given table, useful when transfer data from a table to another table. | |
fun ColumnDeclaring<*>.isNotNull(): UnaryExpression<Boolean> Check if the current column or expression is not null, translated to | |
fun ColumnDeclaring<*>.isNull(): UnaryExpression<Boolean> Check if the current column or expression is null, translated to | |
fun QuerySource.joinReferencesAndSelect(): Query Return a new-created Query object, left joining all the reference tables, and selecting all columns of them. | |
fun <A> Query.joinTo( Append the string from all rows separated using separator and using the given prefix and postfix if supplied. | |
fun Query.joinToString( Create a string from all rows separated using separator and using the given prefix and postfix if supplied. | |
fun QuerySource.leftJoin( Join the right table and return a new QuerySource, translated to | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.less( infix fun <T : Comparable<T>> ColumnDeclaring<T>.less( infix fun <T : Comparable<T>> T.less( Less operator, translated to | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.lessEq( infix fun <T : Comparable<T>> ColumnDeclaring<T>.lessEq( infix fun <T : Comparable<T>> T.lessEq( Less-eq operator, translated to | |
infix fun ColumnDeclaring<*>.like( infix fun ColumnDeclaring<*>.like( Like operator, translated to the | |
Specify the pagination limit parameter of this query. Specify the pagination parameters of this query. | |
fun <R> Query.map( Return a list containing the results of applying the given transform function to each row of the query. | |
Return a list containing the results of applying the given transform function to each row and its index. | |
Return a list containing only the non-null results of applying the given transform function to each row | |
fun <R : Any, C : MutableCollection<in R>> Query.mapIndexedNotNullTo( Apply the given transform function the each row and its index and append only the non-null results to | |
fun <R, C : MutableCollection<in R>> Query.mapIndexedTo( Apply the given transform function the each row and its index and append the results to the given destination. | |
Return a list containing only the non-null results of applying the given transform function to each row of | |
fun <R : Any, C : MutableCollection<in R>> Query.mapNotNullTo( Apply the given transform function to each row of the query and append only the non-null results to | |
fun <R, C : MutableCollection<in R>> Query.mapTo( Apply the given transform function to each row of the query and append the results to the given destination. | |
fun <C : Comparable<C>> max( The max function, translated to | |
fun <C : Comparable<C>> maxDistinct( The max function with distinct, translated to | |
fun <C : Comparable<C>> min( The min function, translated to | |
fun <C : Comparable<C>> minDistinct( The min function with distinct, translated to | |
infix operator fun <T : Number> ColumnDeclaring<T>.minus( infix operator fun <T : Number> ColumnDeclaring<T>.minus( infix operator fun <T : Number> T.minus( Minus operator, translated to | |
operator fun ColumnDeclaring<Boolean>.not(): UnaryExpression<Boolean> Negative operator, translated to the | |
infix fun <T : Comparable<T>> ColumnDeclaring<T>.notBetween( Not-between operator, translated to | |
infix fun <T : Any> ColumnDeclaring<T>.notEq( infix fun <T : Any> ColumnDeclaring<T>.notEq( Not-equal operator, translated to | |
fun notExists(query: Query): ExistsExpression Check if the given query doesn’t have any results, translated to the | |
fun <T : Any> ColumnDeclaring<T>.notInList( infix fun <T : Any> ColumnDeclaring<T>.notInList( infix fun <T : Any> ColumnDeclaring<T>.notInList( Not-in-list operator, translated to the | |
infix fun ColumnDeclaring<*>.notLike( infix fun ColumnDeclaring<*>.notLike( Not like operator, translated to the | |
Specify the pagination offset parameter of this query. | |
infix fun ColumnDeclaring<Boolean>.or( infix fun ColumnDeclaring<Boolean>.or( Or operator, translated to the | |
fun Query.orderBy( fun Query.orderBy(vararg orders: OrderByExpression): Query Specify the | |
infix operator fun <T : Number> ColumnDeclaring<T>.plus( infix operator fun <T : Number> ColumnDeclaring<T>.plus( infix operator fun <T : Number> T.plus( Plus operator, translated to | |
infix operator fun <T : Number> ColumnDeclaring<T>.rem( infix operator fun <T : Number> ColumnDeclaring<T>.rem( infix operator fun <T : Number> T.rem( Mod operator, translated to | |
fun QuerySource.rightJoin( Join the right table and return a new QuerySource, translated to | |
fun QuerySource.select( fun QuerySource.select( Create a query object, selecting the specific columns or expressions from this QuerySource. | |
fun QuerySource.selectDistinct( fun QuerySource.selectDistinct( Create a query object, selecting the specific columns or expressions from this QuerySource distinctly. | |
fun <C : Number> sum( The sum function, translated to | |
fun <C : Number> sumDistinct( The sum function with distinct, translated to | |
infix operator fun <T : Number> ColumnDeclaring<T>.times( infix operator fun <T : Number> ColumnDeclaring<T>.times( infix operator fun <T : Number> T.times( Multiply operator, translated to | |
fun ColumnDeclaring<out Number>.toDouble(): CastingExpression<Double> Cast the current column or expression’s type to Double. | |
fun ColumnDeclaring<out Number>.toFloat(): CastingExpression<Float> Cast the current column or expression’s type to Float. | |
fun ColumnDeclaring<out Number>.toInt(): CastingExpression<Int> fun ColumnDeclaring<Boolean>.toInt(): CastingExpression<Int> Cast the current column or expression’s type to Int. | |
fun ColumnDeclaring<out Number>.toLong(): CastingExpression<Long> Cast the current column or expression’s type to Long. | |
fun ColumnDeclaring<out Number>.toShort(): CastingExpression<Short> Cast the current column or expression’s type to Short. | |
operator fun <T : Number> ColumnDeclaring<T>.unaryMinus(): UnaryExpression<T> Unary minus operator, translated to | |
operator fun <T : Number> ColumnDeclaring<T>.unaryPlus(): UnaryExpression<T> Unary plus operator, translated to | |
Union this query with the given one, corresponding to the | |
Union this query with the given one, corresponding to the | |
Construct an update expression in the given closure, then execute it and return the effected row count. | |
fun Query.where(condition: ColumnDeclaring<Boolean>): Query Specify the fun Query.where( Specify the | |
fun Query.whereWithConditions( Create a mutable list, then add filter conditions to the list in the given callback function, finally combine | |
fun Query.whereWithOrConditions( Create a mutable list, then add filter conditions to the list in the given callback function, finally combine | |
fun Query.withIndex(): Iterable<IndexedValue<QueryRowSet>> Return a lazy Iterable that wraps each row of the query into an IndexedValue containing the index of | |
infix fun ColumnDeclaring<Boolean>.xor( infix fun ColumnDeclaring<Boolean>.xor( Xor operator, translated to the |