All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lightningkite.lightningdb.aggregateExtensions.kt Maven / Gradle / Ivy

The newest version!
package com.lightningkite.lightningdb

import com.lightningkite.khrysalis.IsHashable


/**
 * Runs an aggregation directly on the system.
 * Used for testing and aggregating in the RAM test database.
 */
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() }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy