api-docs / org.ktorm.entity / EntityGrouping
EntityGrouping
class EntityGrouping<E : Any, T : BaseTable<E>, K : Any>
(source code)Wraps an EntitySequence with a keySelector function, which can be applied to each record to get its key,
or used as the group by
clause of the generated SQL.
An EntityGrouping structure serves as an intermediate step in group-and-fold operations: they group elements
by their keys and then fold each group with some aggregation operation.
Entity groups are created by attaching keySelector: (T) -> ColumnDeclaring<K>
function to an entity sequence.
To get an instance of EntityGrouping, use the extension function EntitySequence.groupingBy.
For the list of group-and-fold operations available, see the extension functions below.
Constructors
Name | Summary |
---|---|
EntityGrouping( Wraps an EntitySequence with a keySelector function, which can be applied to each record to get its key, |
Properties
Name | Summary |
---|---|
val keySelector: (T) -> ColumnDeclaring<K> a function used to extract the key of a record in the source table. | |
val sequence: EntitySequence<E, T> the source entity sequence of this grouping. |
Functions
Name | Summary |
---|---|
Create a kotlin.collections.Grouping instance that wraps this original entity grouping returning all the |
Extension Functions
Name | Summary |
---|---|
fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.aggregate( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Any> EntityGrouping<E, T, K>.aggregateColumns( Group elements from the source sequence by key and perform the given aggregation for elements in each group, | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Any, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.aggregateColumnsTo( Group elements from the source sequence by key and perform the given aggregation for elements in each group, | |
fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.aggregateTo( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, | |
fun <E : Any, T : BaseTable<E>, K : Any> EntityGrouping<E, T, K>.eachAverageBy( Group elements from the source sequence by key and average the columns or expressions provided by the | |
fun <E : Any, T : BaseTable<E>, K : Any, M : MutableMap<in K?, in Double?>> EntityGrouping<E, T, K>.eachAverageByTo( Group elements from the source sequence by key and average the columns or expressions provided by the | |
Group elements from the source sequence by key and count elements in each group. | |
fun <E : Any, T : BaseTable<E>, K : Any, M : MutableMap<in K?, Int>> EntityGrouping<E, T, K>.eachCountTo( Group elements from the source sequence by key and count elements in each group, | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>> EntityGrouping<E, T, K>.eachMaxBy( Group elements from the source sequence by key and get the max value of the columns or expressions provided by the | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachMaxByTo( Group elements from the source sequence by key and get the max value of the columns or expressions provided by the | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>> EntityGrouping<E, T, K>.eachMinBy( Group elements from the source sequence by key and get the min value of the columns or expressions provided by the | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Comparable<C>, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachMinByTo( Group elements from the source sequence by key and get the min value of the columns or expressions provided by the | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Number> EntityGrouping<E, T, K>.eachSumBy( Group elements from the source sequence by key and sum the columns or expressions provided by the columnSelector | |
fun <E : Any, T : BaseTable<E>, K : Any, C : Number, M : MutableMap<in K?, in C?>> EntityGrouping<E, T, K>.eachSumByTo( Group elements from the source sequence by key and sum the columns or expressions provided by the columnSelector | |
infix fun <T : Any> T.eq( Equal operator, translated to | |
fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.fold( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, fun <E : Any, K : Any, R> EntityGrouping<E, *, K>.fold( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, | |
fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.foldTo( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, fun <E : Any, K : Any, R, M : MutableMap<in K?, R>> EntityGrouping<E, *, K>.foldTo( Groups elements from the source sequence by key and applies operation to the elements of each group sequentially, | |
infix fun <T : Any> T.neq( Not-equal operator, translated to | |
infix fun <T : Any> T.notEq( Not-equal operator, translated to | |
fun <E : Any, K : Any> EntityGrouping<E, *, K>.reduce( Groups elements from the source sequence by key and applies the reducing operation to the elements of each group | |
fun <E : Any, K : Any, M : MutableMap<in K?, E>> EntityGrouping<E, *, K>.reduceTo( Groups elements from the source sequence by key and applies the reducing operation to the elements of each group |