Documentation ¶
Overview ¶
Package accumulators provides aggregation accumulator operators. Accumulators are different from other operators as they perform operations on a group of documents rather than a single document. They are used only in small subset of available stages (like `$group`).
Accumulators that can be used outside of accumulation with different behaviour (like `$sum`), should be stored in both operators and accumulators packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Accumulators = map[string]newAccumulatorFunc{
"$count": newCount,
"$sum": newSum,
}
Accumulators maps all aggregation accumulators.
Functions ¶
This section is empty.
Types ¶
type Accumulator ¶
type Accumulator interface { // Accumulate documents and returns the result of applying operator. // It should always close iterator. Accumulate(iter types.DocumentsIterator) (any, error) }
Accumulator is a common interface for aggregation accumulation operators.
func NewAccumulator ¶
func NewAccumulator(stage, key string, value any) (Accumulator, error)
NewAccumulator returns accumulator for provided value.
Click to show internal directories.
Click to hide internal directories.