Metakit / @doeixd/metakit/aggregates/sql

AggregateSql

interface · packages/metakit/src/aggregatesSql.ts:60

interface AggregateSql {
  readonly value: SqlFragment
  readonly refused: Option.Option<SqlFragment>
}

An aggregate as two expressions for one SELECT list. Write refused after value and bind [...value.params, ...refused.params]: SQLite binds in the order of the text, and Postgres numbers refused's parameters among value's.

Members

AggregateSql.value

property · packages/metakit/src/aggregatesSql.ts:62

readonly value: SqlFragment

The aggregate's value, NULL where refused holds.

AggregateSql.refused

property · packages/metakit/src/aggregatesSql.ts:69

readonly refused: Option.Option<SqlFragment>

True (SQLite: 1) where evaluate refuses the rows, false (0) where it answers. None where nothing can refuse: no contribution, and no total past the safe range. A sum is also refused where a contribution is not a safe integer, whose total evaluate gives by the order of the rows.