Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder[T any] interface { location.LocationBuilder[T] Calculation(func(CalcVisitor[T], *Calculation) error) Builder[T] CronTab(func(CalcVisitor[T], *time.CronTab) error) Builder[T] Current(func(CalcVisitor[T], *Current) error) Builder[T] Expression(func(CalcVisitor[T], *Expression) error) Builder[T] Function(func(CalcVisitor[T], *Function) error) Builder[T] Load(f func(CalcVisitor[T], *Load) error) Builder[T] Metric(func(CalcVisitor[T], *Metric) error) Builder[T] Script(func(CalcVisitor[T], *Script) error) Builder[T] Unit(f func(CalcVisitor[T], *units.Unit) error) Builder[T] UseFirst(f func(CalcVisitor[T], *UseFirst) error) Builder[T] Build() CalcVisitor[T] }
func NewBuilder ¶
type CalcVisitor ¶
type CalcVisitor[T any] interface { data.DataVisitor[T] location.LocationVisitor[T] Clone() CalcVisitor[T] Calculation(*Calculation) error CronTab(tab *time.CronTab) error Current(*Current) error Expression(*Expression) error Function(*Function) error Load(b *Load) error Metric(*Metric) error Script(*Script) error Unit(b *units.Unit) error UseFirst(b *UseFirst) error }
type Calculation ¶
type Calculation struct { Pos lexer.Position Target string `parser:"'calculate' @String"` // Name of metric to calculate At string `parser:"('at' @String)?"` // If set the Location to use Every *time.CronTab `parser:"('every' @@)?"` // Calculate at specified intervals ResetEvery *time.CronTab `parser:"('reset' 'every' @@)?"` // Crontab to reset the value Load *Load `parser:"(@@)?"` // Load from the DB on startup UseFirst *UseFirst `parser:"(@@)?"` // If set and no value use this expression Expression *Expression `parser:"('as' @@)?"` // Expression to perform calculation }
Calculation defines a metric to calculate
type Expression ¶
type Function ¶
type Function struct { Pos lexer.Position Name string `parser:"@Ident"` Expressions []*Expression `parser:"'(' (@@ (',' @@)*)? ')'"` }
Function handles function calls
type Metric ¶
type Metric struct { Pos lexer.Position Metric []string `parser:"@Ident ( '.' @Ident )*"` Name string }
Metric handles a metric reference
type Script ¶
type State ¶
type State struct { location2.MapContainer // contains filtered or unexported fields }
func (*State) GetCalculation ¶
func (s *State) GetCalculation(n string) *Calculation
func (*State) GetCalculations ¶
func (s *State) GetCalculations() []*Calculation
Click to show internal directories.
Click to hide internal directories.