aggregator

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sum         = functions.Sum
	Count       = functions.Count
	Avg         = functions.Avg
	Max         = functions.Max
	Min         = functions.Min
	StdDev      = functions.StdDev
	Median      = functions.Median
	Percentile  = functions.Percentile
	WindowStart = functions.WindowStart
	WindowEnd   = functions.WindowEnd
	Collect     = functions.Collect
	LastValue   = functions.LastValue
	MergeAgg    = functions.MergeAgg
	StdDevS     = functions.StdDevS
	Deduplicate = functions.Deduplicate
	Var         = functions.Var
	VarS        = functions.VarS
	// 分析函数
	Lag        = functions.Lag
	Latest     = functions.Latest
	ChangedCol = functions.ChangedCol
	HadChanged = functions.HadChanged
	// 表达式聚合器,用于处理自定义函数
	Expression = functions.Expression
)

重新导出所有聚合类型常量

Variables

This section is empty.

Functions

func Register

func Register(name string, constructor func() AggregatorFunction)

Register 添加自定义聚合器到全局注册表,重新导出functions.RegisterLegacyAggregator

Types

type AggregateType

type AggregateType = functions.AggregateType

AggregateType 聚合类型,重新导出functions.AggregateType

type AggregationField

type AggregationField struct {
	InputField    string        // 输入字段名(如 "temperature")
	AggregateType AggregateType // 聚合类型(如 Sum, Avg)
	OutputAlias   string        // 输出别名(如 "temp_sum")
}

AggregationField 定义单个聚合字段的配置

type Aggregator

type Aggregator interface {
	Add(data interface{}) error
	Put(key string, val interface{}) error
	GetResults() ([]map[string]interface{}, error)
	Reset()
	// RegisterExpression 注册表达式计算器
	RegisterExpression(field, expression string, fields []string, evaluator func(data interface{}) (interface{}, error))
}

type AggregatorFunction

type AggregatorFunction = functions.LegacyAggregatorFunction

AggregatorFunction 聚合器函数接口,重新导出functions.LegacyAggregatorFunction

func CreateBuiltinAggregator

func CreateBuiltinAggregator(aggType AggregateType) AggregatorFunction

CreateBuiltinAggregator 创建内置聚合器,重新导出functions.CreateLegacyAggregator

type ContextAggregator

type ContextAggregator = functions.ContextAggregator

ContextAggregator 支持context机制的聚合器接口,重新导出functions.ContextAggregator

type ExpressionAggregatorWrapper

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

ExpressionAggregatorWrapper 包装表达式聚合器,使其兼容LegacyAggregatorFunction接口

func (*ExpressionAggregatorWrapper) Add

func (w *ExpressionAggregatorWrapper) Add(value interface{})

func (*ExpressionAggregatorWrapper) New

func (*ExpressionAggregatorWrapper) Result

func (w *ExpressionAggregatorWrapper) Result() interface{}

type ExpressionEvaluator

type ExpressionEvaluator struct {
	Expression string   // 完整表达式
	Field      string   // 主字段名
	Fields     []string // 表达式中引用的所有字段
	// contains filtered or unexported fields
}

ExpressionEvaluator 包装表达式计算功能

type GroupAggregator

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

func NewGroupAggregator

func NewGroupAggregator(groupFields []string, aggregationFields []AggregationField) *GroupAggregator

NewGroupAggregator 创建新的分组聚合器

func (*GroupAggregator) Add

func (ga *GroupAggregator) Add(data interface{}) error

func (*GroupAggregator) GetResults

func (ga *GroupAggregator) GetResults() ([]map[string]interface{}, error)

func (*GroupAggregator) Put

func (ga *GroupAggregator) Put(key string, val interface{}) error

func (*GroupAggregator) RegisterExpression

func (ga *GroupAggregator) RegisterExpression(field, expression string, fields []string, evaluator func(data interface{}) (interface{}, error))

RegisterExpression 注册表达式计算器

func (*GroupAggregator) Reset

func (ga *GroupAggregator) Reset()

Jump to

Keyboard shortcuts

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