English | 简体中文

api-docs / org.ktorm.dsl / foldIndexed

foldIndexed

inline fun <R> Query.foldIndexed(
    initial: R,
    operation: (index: Int, acc: R, row: QueryRowSet) -> R
): R
(source code)

Accumulate value starting with initial value and applying operation to current accumulator value and each row
with its index in the original query results.

The operation function takes the index of a row, current accumulator value and the row itself,
and calculates the next accumulator value.

Since
3.0.0