mapColumnsTo

@JvmName(name = "_mapColumns2To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, R : MutableCollection<in Tuple2<C1?, C2?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): R
@JvmName(name = "_mapColumns3To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, R : MutableCollection<in Tuple3<C1?, C2?, C3?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): R
@JvmName(name = "_mapColumns4To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, R : MutableCollection<in Tuple4<C1?, C2?, C3?, C4?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): R
@JvmName(name = "_mapColumns5To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, R : MutableCollection<in Tuple5<C1?, C2?, C3?, C4?, C5?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): R
@JvmName(name = "_mapColumns6To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, R : MutableCollection<in Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): R
@JvmName(name = "_mapColumns7To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, R : MutableCollection<in Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): R
@JvmName(name = "_mapColumns8To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, R : MutableCollection<in Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): R
@JvmName(name = "_mapColumns9To")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any, R : MutableCollection<in Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): R

Customize the selected columns of the internal query by the given columnSelector function, and append the query results to the given destination.

This function is similar to EntitySequence.mapTo, but the columnSelector closure accepts the current table object T as the parameter, so what we get in the closure by it is the table object instead of an entity element. Besides, the closure’s return type is a tuple of ColumnDeclaring<C>s, and we should return some columns or expressions to customize the select clause of the generated SQL.

Ktorm supports selecting two or more columns, we just need to wrap our selected columns by tupleOf in the closure, then the function’s return type becomes List<TupleN<C1?, C2?, .. Cn?>>.

The operation is terminal.

Return

the destination collection of the query results.

Since

3.1.0

Parameters

destination

a MutableCollection used to store the results.

isDistinct

specify if the query is distinct, the generated SQL becomes select distinct if it's set to true.

columnSelector

a function in which we should return a tuple of columns or expressions to be selected.


inline fun <E : Any, T : BaseTable<E>, C : Any, R : MutableCollection<in C?>> EntitySequence<E, T>.mapColumnsTo(destination: R, isDistinct: Boolean = false, columnSelector: (T) -> ColumnDeclaring<C>): R(source)

Customize the selected columns of the internal query by the given columnSelector function, and append the query results to the given destination.

This function is similar to EntitySequence.mapTo, but the columnSelector closure accepts the current table object T as the parameter, so what we get in the closure by it is the table object instead of an entity element. Besides, the function’s return type is ColumnDeclaring<C>, and we should return a column or expression to customize the select clause of the generated SQL.

Ktorm also supports selecting two or more columns, we just need to wrap our selected columns by tupleOf in the closure, then the function’s return type becomes List<TupleN<C1?, C2?, .. Cn?>>.

The operation is terminal.

Return

the destination collection of the query results.

Parameters

destination

a MutableCollection used to store the results.

isDistinct

specify if the query is distinct, the generated SQL becomes select distinct if it's set to true.

columnSelector

a function in which we should return a column or expression to be selected.