average method
Averages non-null inputs, rounding once at the requested result scale. Empty/all-null input returns null; the default rejects lost digits.
Implementation
Expr<Decimal?> average({
required int scale,
DecimalRounding rounding = DecimalRounding.exact,
}) {
Decimal.validateScale(scale);
if (window(expressionNode)) {
throw const OrmException(
'QUERY.WINDOW',
'Project a window result through a CTE before averaging it.',
);
}
return Expr.internal(
DecimalAverage(expressionNode, scale, rounding),
Codecs.decimal.nullable(),
);
}