aggregateColumns

@JvmName(name = "_aggregateColumns2")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): Tuple2<C1?, C2?>
@JvmName(name = "_aggregateColumns3")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): Tuple3<C1?, C2?, C3?>
@JvmName(name = "_aggregateColumns4")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): Tuple4<C1?, C2?, C3?, C4?>
@JvmName(name = "_aggregateColumns5")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): Tuple5<C1?, C2?, C3?, C4?, C5?>
@JvmName(name = "_aggregateColumns6")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>
@JvmName(name = "_aggregateColumns7")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>
@JvmName(name = "_aggregateColumns8")
inline fun <E : Any, T : BaseTable<E>, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>
@JvmName(name = "_aggregateColumns9")
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> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>

Perform a tuple of aggregations given by aggregationSelector for all elements in the sequence, and return the aggregate results.

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

The operation is terminal.

Return

a tuple of the aggregate results.

Since

3.1.0

Parameters

aggregationSelector

a function that accepts the source table and returns a tuple of aggregate expressions.


@JvmName(name = "_aggregateColumns2")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple2<ColumnDeclaring<C1>, ColumnDeclaring<C2>>): Map<K?, Tuple2<C1?, C2?>>
@JvmName(name = "_aggregateColumns3")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple3<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>>): Map<K?, Tuple3<C1?, C2?, C3?>>
@JvmName(name = "_aggregateColumns4")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple4<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>>): Map<K?, Tuple4<C1?, C2?, C3?, C4?>>
@JvmName(name = "_aggregateColumns5")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple5<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>>): Map<K?, Tuple5<C1?, C2?, C3?, C4?, C5?>>
@JvmName(name = "_aggregateColumns6")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple6<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>>): Map<K?, Tuple6<C1?, C2?, C3?, C4?, C5?, C6?>>
@JvmName(name = "_aggregateColumns7")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple7<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>>): Map<K?, Tuple7<C1?, C2?, C3?, C4?, C5?, C6?, C7?>>
@JvmName(name = "_aggregateColumns8")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple8<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>>): Map<K?, Tuple8<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?>>
@JvmName(name = "_aggregateColumns9")
inline fun <E : Any, T : BaseTable<E>, K : Any, C1 : Any, C2 : Any, C3 : Any, C4 : Any, C5 : Any, C6 : Any, C7 : Any, C8 : Any, C9 : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> Tuple9<ColumnDeclaring<C1>, ColumnDeclaring<C2>, ColumnDeclaring<C3>, ColumnDeclaring<C4>, ColumnDeclaring<C5>, ColumnDeclaring<C6>, ColumnDeclaring<C7>, ColumnDeclaring<C8>, ColumnDeclaring<C9>>): Map<K?, Tuple9<C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?>>

Group elements from the source sequence by key and perform the given aggregations for elements in each group, then store the results in a new Map.

The key for each group is provided by the EntityGrouping.keySelector function, and the generated SQL is like: select key, aggregation from source group by key.

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

Return

a Map associating the key of each group with the results of aggregations of the group elements.

Since

3.1.0

Parameters

aggregationSelector

a function that accepts the source table and returns a tuple of aggregate expressions.


inline fun <E : Any, T : BaseTable<E>, K : Any, C : Any> EntityGrouping<E, T, K>.aggregateColumns(aggregationSelector: (T) -> ColumnDeclaring<C>): Map<K?, C?>(source)

Group elements from the source sequence by key and perform the given aggregation for elements in each group, then store the results in a new Map.

The key for each group is provided by the EntityGrouping.keySelector function, and the generated SQL is like: select key, aggregation from source group by key.

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

Return

a Map associating the key of each group with the result of aggregation of the group elements.

Parameters

aggregationSelector

a function that accepts the source table and returns the aggregate expression.


inline fun <E : Any, T : BaseTable<E>, C : Any> EntitySequence<E, T>.aggregateColumns(aggregationSelector: (T) -> ColumnDeclaring<C>): C?(source)

Perform an aggregation given by aggregationSelector for all elements in the sequence, and return the aggregate result.

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

The operation is terminal.

Return

the aggregate result.

Parameters

aggregationSelector

a function that accepts the source table and returns the aggregate expression.