window

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Input      = NewParamName("input")
	Unit       = NewParamName("unit")
	NUppercase = NewParamName("N")
	NLowercase = NewParamName("n")
	Alpha      = NewParamName("alpha")
	Output     = NewParamName("output")
	By         = NewParamName("by")
	Default    = NewParamName("default")
	SortBy     = NewParamName("sortBy")
)

Functions

func AddToSet

func AddToSet[T expression.AnyExpression](path string, e T, window Window) outputOperator

AddToSet Returns an array of all unique values that results from applying an expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func Avg

func Avg[T expression.AnyExpression](path string, e T, window Window) outputOperator

Avg Returns the average for the specified expression . Ignores non-numeric values. Changed in version 5.0: Available in $setWindowFields stage.

func Bottom

func Bottom[O expression.AnyExpression](path string, sortBy bsonx.Bson, out O, window Window) outputOperator

Bottom Returns the bottom element within a group according to the specified sort order. NewDefaultStage in version 5.2. Available in $group and $setWindowFields stages.

func BottomN

func BottomN[I expression.AnyExpression, O expression.AnyExpression, N expression.IntExpression](path string, in I, out O, n N, window Window) outputOperator

BottomN Returns an aggregation of the bottom n fields within a group, according to the specified sort order. NewDefaultStage in version 5.2. Available in $group and $setWindowFields stages.

func Count

func Count(path string, window Window) outputOperator

Count Returns the number of documents in the group or window. Distinct from the $count pipeline stage. NewDefaultStage in version 5.0.

func CovariancePop

func CovariancePop[T expression.AnyExpression](path string, expr1, expr2 T, window Window) outputOperator

CovariancePop Returns the population covariance of two numeric expressions. NewDefaultStage in version 5.0.

func CovarianceSamp

func CovarianceSamp[T expression.AnyExpression](path string, expr1, expr2 T, window Window) outputOperator

CovarianceSamp Returns the sample covariance of two numeric expressions. NewDefaultStage in version 5.0.

func DenseRank

func DenseRank(path string) outputOperator

DenseRank Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. There are no gaps in the ranks. Ties receive the same rank. NewDefaultStage in version 5.0.

func Derivative

func Derivative[I expression.AnyExpression](path string, in I, window Window) outputOperator

Derivative Returns the average rate of change within the specified window. NewDefaultStage in version 5.0.

func DocumentNumber

func DocumentNumber(path string) outputOperator

DocumentNumber Returns the position of a document (known as the document number) in the $setWindowFields stage partition. Ties result in different adjacent document numbers. NewDefaultStage in version 5.0.

func ExpMovingAvg

func ExpMovingAvg[T expression.AnyExpression](path string, e T, n int32) outputOperator

ExpMovingAvg Returns the exponential moving average for the numeric expression. NewDefaultStage in version 5.0.

func ExpMovingAvgAlpha

func ExpMovingAvgAlpha[T expression.AnyExpression](path string, e T, alpha float64) outputOperator

ExpMovingAvgAlpha Returns the exponential moving average for the numeric expression. NewDefaultStage in version 5.0.

func First

func First[T expression.AnyExpression](path string, e T, window Window) outputOperator

First Returns the value that results from applying an expression to the first document in a group or window. Changed in version 5.0: Available in $setWindowFields stage.

func Integral

func Integral[T expression.AnyExpression](path string, e T, window Window) outputOperator

Integral Returns the approximation of the area under a curve. NewDefaultStage in version 5.0.

func Last

func Last[T expression.AnyExpression](path string, e T, window Window) outputOperator

Last Returns the value that results from applying an expression to the last document in a group or window. Changed in version 5.0: Available in $setWindowFields stage.

func LinearFill

func LinearFill[T expression.AnyExpression](path string, e T) outputOperator

LinearFill Fills null and missing fields in a window using linear interpolation based on surrounding field values. Available in $setWindowFields stage. NewDefaultStage in version 5.3.

func Locf

func Locf[T expression.AnyExpression](path string, e T) outputOperator

Locf Last observation carried forward. Sets values for null and missing fields in a window to the last non-null value for the field. Available in $setWindowFields stage. NewDefaultStage in version 5.2.

func Max

func Max[T expression.AnyExpression](path string, e T, window Window) outputOperator

Max Returns the maximum value that results from applying an expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func Min

func Min[T expression.AnyExpression](path string, e T, window Window) outputOperator

Min Returns the minimum value that results from applying an expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func MinN

func MinN[I expression.AnyExpression, N expression.IntExpression](path string, in I, n N, window Window) outputOperator

MinN Returns an aggregation of the n minimum valued elements in a group. Distinct from the $minN array operator. NewDefaultStage in version 5.2. Available in $group, $setWindowFields and as an expression.

func Push

func Push[T expression.AnyExpression](path string, e T, window Window) outputOperator

Push Returns an array of values that result from applying an expression to each document.Changed Changed in version 5.0: Available in $setWindowFields stage.

func Rank

func Rank(path string) outputOperator

Rank Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. NewDefaultStage in version 5.0.

func Shift

func Shift[T expression.AnyExpression](path string, e, defaultExpression T, by int32) outputOperator

Shift Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition. NewDefaultStage in version 5.0.

func StdDevPop

func StdDevPop[T expression.AnyExpression](path string, e T, window Window) outputOperator

StdDevPop Returns the population standard deviation that results from applying a numeric expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func StdDevSamp

func StdDevSamp[T expression.AnyExpression](path string, e T, window Window) outputOperator

StdDevSamp Returns the sample standard deviation that results from applying a numeric expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func Sum

func Sum[T expression.AnyExpression](path string, e T, window Window) outputOperator

Sum Returns the sum that results from applying a numeric expression to each document. Changed in version 5.0: Available in $setWindowFields stage.

func TimeDerivative

func TimeDerivative[T expression.AnyExpression](path string, e T, window Window, unit options.MongoTimeUnit) outputOperator

TimeDerivative Returns the average rate of change within the specified window. NewDefaultStage in version 5.0.

func TimeIntegral

func TimeIntegral[T expression.AnyExpression](path string, e T, window Window, unit options.MongoTimeUnit) outputOperator

TimeIntegral Returns the approximation of the area under a curve. NewDefaultStage in version 5.0.

func Top

func Top[O expression.AnyExpression](path string, sortBy bsonx.Bson, out O, window Window) outputOperator

Top Returns the top element within a group according to the specified sort order. NewDefaultStage in version 5.2. Available in $group and $setWindowFields stages.

func TopN

func TopN[O expression.AnyExpression, N expression.IntExpression](path string, sortBy bsonx.Bson, out O, n N, window Window) outputOperator

TopN Returns an aggregation of the top n fields within a group, according to the specified sort order. NewDefaultStage in version 5.2. Available in $group and $setWindowFields stages.

Types

type AbstractFunctionAndWindow

type AbstractFunctionAndWindow struct {
	// contains filtered or unexported fields
}

func NewAbstractFunctionAndWindow

func NewAbstractFunctionAndWindow(functionName string, window Window) AbstractFunctionAndWindow

func (AbstractFunctionAndWindow) BsonDocument

func (a AbstractFunctionAndWindow) BsonDocument() *bsonx.BsonDocument

func (AbstractFunctionAndWindow) Document

func (a AbstractFunctionAndWindow) Document() bson.D

func (AbstractFunctionAndWindow) Exp

type CompoundParameterFunctionAndWindow

type CompoundParameterFunctionAndWindow[T expression.Expression] struct {
	AbstractFunctionAndWindow
	// contains filtered or unexported fields
}

func NewCompoundParameterFunctionAndWindow

func NewCompoundParameterFunctionAndWindow[T expression.Expression](functionName string, args map[ParamName]T, window Window) CompoundParameterFunctionAndWindow[T]

func (CompoundParameterFunctionAndWindow[T]) BsonDocument

func (CompoundParameterFunctionAndWindow[T]) Document

func (a CompoundParameterFunctionAndWindow[T]) Document() bson.D

func (CompoundParameterFunctionAndWindow[T]) Exp

type ParamName

type ParamName struct {
	// contains filtered or unexported fields
}

func NewParamName

func NewParamName(value string) ParamName

type SimpleParameterFunctionAndWindow

type SimpleParameterFunctionAndWindow[T expression.AnyExpression] struct {
	AbstractFunctionAndWindow
	// contains filtered or unexported fields
}

func NewSimpleParameterFunctionAndWindow

func NewSimpleParameterFunctionAndWindow[T expression.AnyExpression](functionName string, expression T, window Window) SimpleParameterFunctionAndWindow[T]

func (SimpleParameterFunctionAndWindow[T]) BsonDocument

func (SimpleParameterFunctionAndWindow[T]) Document

func (a SimpleParameterFunctionAndWindow[T]) Document() bson.D

func (SimpleParameterFunctionAndWindow[T]) Exp

type Window

type Window bsonx.Bson

type WindowOutputField

type WindowOutputField interface {
	expression.Expression
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL