ktorm icon indicating copy to clipboard operation
ktorm copied to clipboard

groupingBy multiple columns?

Open 2x2xplz opened this issue 2 years ago • 1 comments

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()

2x2xplz avatar Dec 19 '22 07:12 2x2xplz

Good suggestion, will consider adding this feature.

vincentlauvlwj avatar Dec 19 '22 08:12 vincentlauvlwj