com.lightningkite.ktordb.aggregateExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of db Show documentation
Show all versions of db Show documentation
An abstract tool for communicating with different types of databases.
The newest version!
package com.lightningkite.ktordb
import com.lightningkite.khrysalis.IsHashable
fun Sequence>.aggregate(aggregate: Aggregate): Map {
val aggregators = HashMap()
for (entry in this) {
aggregators.getOrPut(entry.first) { aggregate.aggregator() }.consume(entry.second)
}
return aggregators.mapValues { it.value.complete() }
}