AggregateFunctionExpression<D extends Object> class final

An expression invoking an aggregate function.

Aggregate functions, like count() or sum() collapse the entire data set (or a partition of it, if GROUP BY is used) into a single value.

Drift exposes direct bindings to most aggregate functions (e.g. via BaseAggregate.count). This class is useful when writing custom aggregate function invocations.

Inheritance
Available Extensions

Constructors

AggregateFunctionExpression(String functionName, List<FunctionParameter> arguments, {Expression<bool>? filter, bool distinct = false, OrderBy? orderBy})
Creates an aggregate function expression from the syntactic components.

Properties

arguments List<FunctionParameter>
The arguments to pass to the function.
final
distinct bool
Whether only distinct rows should be passed to the function.
final
driftSqlType → BaseSqlType<D>
The BaseSqlType backing this expression.
no setterinherited
filter Where?
An optional filter clause only passing rows matching this condition into the function.
final
functionName String
The name of the aggregate function to invoke.
final
hashCode int
The hash code for this object.
no setteroverride
isLiteral bool
Whether this expression is a literal. Some use-sites need to put parentheses around non-literals.
no setterinherited
orderBy OrderBy?
The order in which rows of the current group should be passed to the aggregate function.
final
precedence Precedence
The precedence of this expression. This can be used to automatically put parentheses around expressions as needed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

caseMatch<T extends Object>({required Map<Expression<D>, Expression<T>> when, Expression<T>? orElse}) Expression<T>
A CASE WHEN construct using the current expression as a base.
inherited
cast<D2 extends Object>([BaseSqlType<D2>? type]) Expression<D2>
Generates a CAST(expression AS TYPE) expression.
inherited
dartCast<D2 extends Object>({CustomSqlType<D2>? customType}) Expression<D2>
Casts this expression to an expression of D.
inherited
equals(D compare) Expression<bool>
Whether this column is equal to the given value, which must have a fitting type. The compare value will be written as a variable using prepared statements, so there is no risk of an SQL-injection.
inherited
equalsExp(Expression<D> compare) Expression<bool>
Whether this expression is equal to the given expression.
inherited
equalsNullable(D? compare) Expression<bool>
Compares the value of this column to compare or null.
inherited
iif<T extends Object>(Expression<bool> predicate, Expression<T> ifFalse) Expression<T>
Evaluates to this if predicate is true, otherwise evaluates to ifFalse.
inherited
isExp(Expression<D> other) Expression<bool>
Generates an IS expression in SQL, comparing this expression with the other expression.
inherited
isIn(Iterable<D> values) Expression<bool>
An expression that is true if this resolves to any of the values in values.
inherited
isInExp(List<Expression<D>> expressions) Expression<bool>
An expression that evaluates to true if this expression resolves to a value that one of the expressions resolve to as well.
inherited
isInQuery(BaseSelectStatement select) Expression<bool>
An expression checking whether this is included in any row of the provided select statement.
inherited
isNotExp(Expression<D> other) Expression<bool>
Generates an IS NOT expression in SQL, comparing this expression with the other expression.
inherited
isNotIn(Iterable<D> values) Expression<bool>
An expression that is true if this does not resolve to any of the values in values.
inherited
isNotInExp(List<Expression<D>> expressions) Expression<bool>
An expression that evaluates to true if this expression does not resolve to any value that the expressions resolve to.
inherited
isNotInQuery(BaseSelectStatement select) Expression<bool>
An expression checking whether this is not included in any row of the provided select statement.
inherited
isNotNull() Expression<bool>
Expression that is true if the inner expression resolves to a non-null value.
inherited
isNotValue(D value) Expression<bool>
Generates an IS NOT expression in SQL, comparing this expression with the Dart value.
inherited
isNull() Expression<bool>
Expression that is true if the inner expression resolves to a null value.
inherited
isValue(D value) Expression<bool>
Generates an IS expression in SQL, comparing this expression with the Dart value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullIf(Expression<D> matcher) Expression<D>
Returns null if matcher is equal to this expression, this otherwise.
inherited
toString() String
A string representation of this object.
inherited
writeAroundPrecedence(GenerationContext context, Precedence precedence) → void
Writes this expression into the GenerationContext, assuming that there's an outer expression with precedence. If the Expression.precedence of this expression is lower, it will be wrap}ped in
inherited
writeInner(GenerationContext ctx, Expression<Object> inner) → void
If this Expression wraps an inner expression, this utility method can be used inside writeInto to write that inner expression while wrapping it in parentheses if necessary.
inherited
writeInto(GenerationContext context) → void
Writes this component into the context by writing to its GenerationContext.buffer or by introducing bound variables. When writing into the buffer, no whitespace around the this component should be introduced. When a component consists of multiple composed component, it's responsible for introducing whitespace between its child components.
override

Operators

operator ==(Object other) bool
The equality operator.
override