aggregate

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator interface {
	ProcessValue(any) error
	ResultStrings() (map[string]string, error)
	ResultFormattedStrings(format string) ([]string, error)
	ResultJSON() ([]byte, error)
	Type() string
}

Aggregator can summarize rpc reply data

func AggregatorByType

func AggregatorByType(t string, args []any) (Aggregator, error)

AggregatorByType retrieves an instance of an aggregator given its type like "summarize"

type AverageAggregator

type AverageAggregator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AverageAggregator averages seen values

func NewAverageAggregator

func NewAverageAggregator(args []any) (*AverageAggregator, error)

NewAverageAggregator creates a new AverageAggregator with the specific options supplied

func (*AverageAggregator) ProcessValue

func (a *AverageAggregator) ProcessValue(v any) error

ProcessValue processes and tracks the specific value

func (*AverageAggregator) ResultFormattedStrings

func (a *AverageAggregator) ResultFormattedStrings(format string) ([]string, error)

ResultFormattedStrings return the results in a formatted way, if no format is given a calculated value is used

func (*AverageAggregator) ResultJSON

func (a *AverageAggregator) ResultJSON() ([]byte, error)

ResultJSON return the results in JSON format preserving types

func (*AverageAggregator) ResultStrings

func (a *AverageAggregator) ResultStrings() (map[string]string, error)

ResultStrings returns a map of results in string format

func (*AverageAggregator) Type

func (a *AverageAggregator) Type() string

Type is the type of Aggregator

type ChartAggregator

type ChartAggregator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ChartAggregator tracks seen values and produce a chart with values bucketed in groups of 50

func NewChartAggregator

func NewChartAggregator(args []any) (*ChartAggregator, error)

NewChartAggregator creates a new ChartAggregator with the specific options

func (*ChartAggregator) ProcessValue

func (s *ChartAggregator) ProcessValue(v any) error

ProcessValue processes and tracks the specific value

func (*ChartAggregator) ResultFormattedStrings

func (s *ChartAggregator) ResultFormattedStrings(format string) ([]string, error)

ResultFormattedStrings returns the chart as a formatted string

func (*ChartAggregator) ResultJSON

func (s *ChartAggregator) ResultJSON() ([]byte, error)

ResultJSON return the chart as a JSON document with the key "chart"

func (*ChartAggregator) ResultStrings

func (s *ChartAggregator) ResultStrings() (map[string]string, error)

ResultStrings returns a map of results in string format in the key "Chart"

func (*ChartAggregator) Type

func (s *ChartAggregator) Type() string

Type is the type of Aggregator

type SummaryAggregator

type SummaryAggregator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SummaryAggregator keeps track of seen values and summarize how many times each were seen

func NewSummaryAggregator

func NewSummaryAggregator(args []any) (*SummaryAggregator, error)

NewSummaryAggregator creates a new SummaryAggregator with the specific options supplied

func (*SummaryAggregator) ProcessValue

func (s *SummaryAggregator) ProcessValue(v any) error

ProcessValue processes and tracks a specified value

func (*SummaryAggregator) ResultFormattedStrings

func (s *SummaryAggregator) ResultFormattedStrings(format string) ([]string, error)

ResultFormattedStrings return the results in a formatted way, if no format is given a calculated value is used

func (*SummaryAggregator) ResultJSON

func (s *SummaryAggregator) ResultJSON() ([]byte, error)

ResultJSON return the results in JSON format preserving types

func (*SummaryAggregator) ResultStrings

func (s *SummaryAggregator) ResultStrings() (map[string]string, error)

ResultStrings returns a map of results in string format

func (*SummaryAggregator) Type

func (s *SummaryAggregator) Type() string

Type is the type of Aggregator

Jump to

Keyboard shortcuts

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