← Back to Stormify Documentation

SingleAggregator

expect class SingleAggregator

A single-aggregation view on a PagedAggregator chain. Returned by each PagedAggregator builder method (the "one aggregate" case).

Two ways to execute:

  1. Immediately as a typed scalar via execute — returns the single column value.

  2. Chain another aggregation (.sum, .avg, …, .raw) to produce a MultiAggregator whose execute() returns a Map<String, Any?>.

The expect / actual split exists so the JVM actual can add a execute(Class<R>) overload for Java callers without polluting the Native surface.

val total: BigDecimal? = list.getAggregator()
.sum(Company_.revenue)
.execute<BigDecimal>()
actual class SingleAggregator

JVM / Android actual of SingleAggregator. Adds a Java-friendly execute(Class<R>) overload on top of the common API so Java callers can write agg.sum(path).execute(BigDecimal.class).

actual class SingleAggregator

Native actual of SingleAggregator. Delegates to the shared SingleAggregatorCore with no platform-specific additions.

Properties

Link copied to clipboard
expect val query: String

The SQL that execute will run against the database.

actual val query: String

The SQL that execute will run against the database.

actual val query: String

The SQL that execute will run against the database.

Functions

Link copied to clipboard
expect fun avg(path: String, alias: String? = null): MultiAggregator

Chains an AVG(path) aggregation and returns the resulting MultiAggregator.

expect fun avg(path: ScalarPath, alias: String? = null): MultiAggregator

Chains an AVG(path) aggregation using a type-safe ScalarPath.

actual fun avg(path: String, alias: String?): MultiAggregator

Chains an AVG(path) aggregation and returns the resulting MultiAggregator.

actual fun avg(path: ScalarPath, alias: String?): MultiAggregator

Chains an AVG(path) aggregation using a type-safe ScalarPath.

actual fun avg(path: String, alias: String?): MultiAggregator

Chains an AVG(path) aggregation and returns the resulting MultiAggregator.

actual fun avg(path: ScalarPath, alias: String?): MultiAggregator

Chains an AVG(path) aggregation using a type-safe ScalarPath.

Link copied to clipboard
expect fun count(path: String, alias: String? = null): MultiAggregator

Chains a COUNT(path) aggregation. Pass "*" for COUNT(*).

expect fun count(path: ScalarPath, alias: String? = null): MultiAggregator

Chains a COUNT(path) aggregation using a type-safe ScalarPath.

actual fun count(path: String, alias: String?): MultiAggregator

Chains a COUNT(path) aggregation. Pass "*" for COUNT(*).

actual fun count(path: ScalarPath, alias: String?): MultiAggregator

Chains a COUNT(path) aggregation using a type-safe ScalarPath.

actual fun count(path: String, alias: String?): MultiAggregator

Chains a COUNT(path) aggregation. Pass "*" for COUNT(*).

actual fun count(path: ScalarPath, alias: String?): MultiAggregator

Chains a COUNT(path) aggregation using a type-safe ScalarPath.

Link copied to clipboard
expect fun countDistinct(path: String, alias: String? = null): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation.

expect fun countDistinct(path: ScalarPath, alias: String? = null): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation using a type-safe ScalarPath.

actual fun countDistinct(path: String, alias: String?): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation.

actual fun countDistinct(path: ScalarPath, alias: String?): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation using a type-safe ScalarPath.

actual fun countDistinct(path: String, alias: String?): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation.

actual fun countDistinct(path: ScalarPath, alias: String?): MultiAggregator

Chains a COUNT(DISTINCT path) aggregation using a type-safe ScalarPath.

Link copied to clipboard
expect fun <R : Any> execute(type: KClass<R>): R?

Executes the single-value aggregation and returns the column value cast to type, or null if no rows match the current filter state.

fun <R : Any> execute(type: Class<R>): R?

Java-friendly overload of execute that accepts a Class instead of a Kotlin KClass. Delegates to the common implementation.

actual fun <R : Any> execute(type: KClass<R>): R?

Executes the single-value aggregation and returns the column value cast to type, or null if no rows match the current filter state.

actual fun <R : Any> execute(type: KClass<R>): R?

Executes the single-value aggregation and returns the column value cast to type, or null if no rows match the current filter state.

Link copied to clipboard
inline fun <R : Any> SingleAggregator.execute(): R?

Reified convenience over SingleAggregator.execute — keeps the Kotlin call sites (aggregator.sum(path).execute<BigDecimal>()) concise.

Link copied to clipboard
expect fun max(path: String, alias: String? = null): MultiAggregator

Chains a MAX(path) aggregation and returns the resulting MultiAggregator.

expect fun max(path: ScalarPath, alias: String? = null): MultiAggregator

Chains a MAX(path) aggregation using a type-safe ScalarPath.

actual fun max(path: String, alias: String?): MultiAggregator

Chains a MAX(path) aggregation and returns the resulting MultiAggregator.

actual fun max(path: ScalarPath, alias: String?): MultiAggregator

Chains a MAX(path) aggregation using a type-safe ScalarPath.

actual fun max(path: String, alias: String?): MultiAggregator

Chains a MAX(path) aggregation and returns the resulting MultiAggregator.

actual fun max(path: ScalarPath, alias: String?): MultiAggregator

Chains a MAX(path) aggregation using a type-safe ScalarPath.

Link copied to clipboard
expect fun min(path: String, alias: String? = null): MultiAggregator

Chains a MIN(path) aggregation and returns the resulting MultiAggregator.

expect fun min(path: ScalarPath, alias: String? = null): MultiAggregator

Chains a MIN(path) aggregation using a type-safe ScalarPath.

actual fun min(path: String, alias: String?): MultiAggregator

Chains a MIN(path) aggregation and returns the resulting MultiAggregator.

actual fun min(path: ScalarPath, alias: String?): MultiAggregator

Chains a MIN(path) aggregation using a type-safe ScalarPath.

actual fun min(path: String, alias: String?): MultiAggregator

Chains a MIN(path) aggregation and returns the resulting MultiAggregator.

actual fun min(path: ScalarPath, alias: String?): MultiAggregator

Chains a MIN(path) aggregation using a type-safe ScalarPath.

Link copied to clipboard
expect fun raw(expression: String, alias: String? = null): MultiAggregator

Chains an arbitrary SQL expression into the aggregation list.

actual fun raw(expression: String, alias: String?): MultiAggregator

Chains an arbitrary SQL expression into the aggregation list.

actual fun raw(expression: String, alias: String?): MultiAggregator

Chains an arbitrary SQL expression into the aggregation list.

Link copied to clipboard
expect fun sum(path: String, alias: String? = null): MultiAggregator

Chains a SUM(path) aggregation and returns the resulting MultiAggregator.

expect fun sum(path: ScalarPath, alias: String? = null): MultiAggregator

Chains a SUM(path) aggregation using a type-safe ScalarPath.

actual fun sum(path: String, alias: String?): MultiAggregator

Chains a SUM(path) aggregation and returns the resulting MultiAggregator.

actual fun sum(path: ScalarPath, alias: String?): MultiAggregator

Chains a SUM(path) aggregation using a type-safe ScalarPath.

actual fun sum(path: String, alias: String?): MultiAggregator

Chains a SUM(path) aggregation and returns the resulting MultiAggregator.

actual fun sum(path: ScalarPath, alias: String?): MultiAggregator

Chains a SUM(path) aggregation using a type-safe ScalarPath.