ktorm
ktorm copied to clipboard
groupingBy multiple columns?
Is it possible to use the native entity DSL to perform a group by on multiple columns?
database.sales.groupingBy {
it.salesRegion, it.productFamily, it.month, it.channel
}.aggregateColumns {
sum(it.salesVolume)
}
I thought tupleOf() would work for the above, since groupingBy and aggregateColumns have similar parameters (below) but this does not work.
groupingBy:
keySelector: (T) -> ColumnDeclaring<K> // does not accept tupleOf()
aggregateColumns:
aggregationSelector: (T) -> ColumnDeclaring<C> // accepts tupleOf()
Good suggestion, will consider adding this feature.