Database.Reducer

Database

SQL aggregates over Rows queries.

Typed column reducers live on modules like Database.Int64 (sum, ands, ors, xors). Apply them with Rows.reduce:

access orders token
    |> reduce (Database.Int64.sum .total)

Rows.count / Rows.sum remain for simple aggregates that take a Rows pipeline directly.

Types

Reducer

type Reducer row result = Reducer

A compiled aggregate over rows of type row, producing result.

Examples

access orders token
    |> reduce (Database.Int64.sum .total)

Values

count

count : Reducer row Int

Count rows (SELECT COUNT(*)). Use with Rows.reduce.

Examples

access items token
    |> reduce Reducer.count