@serenity-is/corelib / Aggregators / Avg
Class: Avg
Defined in: src/slick/aggregators.ts:17
Average of a numeric field (ignores non-numeric / empty values).
Implements
Constructors
Constructor
new Avg(
field):Avg
Defined in: src/slick/aggregators.ts:29
Creates a new average aggregator.
Parameters
field
string
The field to average.
Returns
Avg
Properties
count
count:
number
Defined in: src/slick/aggregators.ts:19
Number of items processed.
field
readonlyfield:string
Defined in: src/slick/aggregators.ts:29
The field to average.
nonNullCount
nonNullCount:
number
Defined in: src/slick/aggregators.ts:21
Number of non-null numeric values.
sum
sum:
number
Defined in: src/slick/aggregators.ts:23
Running sum of valid values.
aggregateKey
readonlystaticaggregateKey:"avg"="avg"
Defined in: src/slick/aggregators.ts:60
Key used to store/lookup this aggregator in totals.
summaryType
readonlystaticsummaryType:Avg=SummaryType.Avg
Defined in: src/slick/aggregators.ts:58
Summary type for this aggregator.
Accessors
displayName
Get Signature
get
staticdisplayName():string
Defined in: src/slick/aggregators.ts:62
Localized display name for this aggregator.
Returns
string
Methods
accumulate()
accumulate(
item):void
Defined in: src/slick/aggregators.ts:40
Accumulates a single item into the aggregator state.
Parameters
item
any
Row item to accumulate; the configured field value is parsed as a number when valid.
Returns
void
Implementation of
init()
init():
void
Defined in: src/slick/aggregators.ts:33
Initializes state before a new group is processed.
Returns
void
Implementation of
storeResult()
storeResult(
groupTotals):void
Defined in: src/slick/aggregators.ts:50
Writes computed totals into the group totals object.
Parameters
groupTotals
IGroupTotals
Totals container to write the computed average into, keyed by field name.
Returns
void