egress

package
v0.0.0-...-d8ac9bd Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParser

func NewParser() util.Parser[Script]

Types

type Action

type Action struct {
	Pos    lexer.Position
	Metric *Metric `parser:"( @@ )"`
}

type Builder

type Builder[T any] interface {
	Action(func(EgressVisitor[T], *Action) error) Builder[T]
	Amqp(func(EgressVisitor[T], *amqp.Amqp) error) Builder[T]
	Metric(f func(EgressVisitor[T], *Metric) error) Builder[T]
	Publish(f func(EgressVisitor[T], *Publish) error) Builder[T]
	Script(func(EgressVisitor[T], *Script) error) Builder[T]
	Build() EgressVisitor[T]
}

func NewBuilder

func NewBuilder[T any]() Builder[T]

type EgressVisitor

type EgressVisitor[T any] interface {
	Action(*Action) error
	Amqp(*amqp.Amqp) error
	Metric(*Metric) error
	Publish(*Publish) error
	Script(*Script) error
	GetData() T
	SetData(T) EgressVisitor[T]
}

type Marshaller

type Marshaller func(v any) ([]byte, error)

type Metric

type Metric struct {
	Pos       lexer.Position
	Metrics   []string           `parser:"'metric' (@String | 'in' '(' @String (',' @String)* ')' )"`
	Statement *script.Statements `parser:"(@@)?"`
	Publish   []*Publish         `parser:"'publish' (@@)+"`
}

Metric on receipt

type MetricFilter

type MetricFilter func(string) *Metric

type Publish

type Publish struct {
	Pos     lexer.Position
	Amqp    string       `parser:"( 'amqp' @String"`
	Console bool         `parser:"| @'console' )"`
	As      *PublishType `parser:"(@@)?"`
}

type PublishType

type PublishType struct {
	Pos    lexer.Position
	Bytes  bool `parser:"'as' ( @'bytes'"`
	Json   bool `parser:"| @'json'"`
	String bool `parser:"| @('string' | 'text')"`
	Xml    bool `parser:"| @'xml'"`
	Yaml   bool `parser:"| @'yaml' )"`
}

func (*PublishType) Marshaller

func (p *PublishType) Marshaller() Marshaller

type Script

type Script struct {
	Pos lexer.Position
	//Locations []*calc.Location `parser:"(@@)*"` // Share the same from calculator
	Amqp    []*amqp.Amqp `parser:"(@@)?"`
	Actions []*Action    `parser:"(@@)+"`
	// contains filtered or unexported fields
}

func (*Script) State

func (s *Script) State() *State

type State

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

func NewState

func NewState() *State

func (*State) AddAmqp

func (s *State) AddAmqp(a *amqp2.Amqp) error

func (*State) AddMetric

func (s *State) AddMetric(n string, m *Metric)

func (*State) Cleanup

func (s *State) Cleanup() *State

func (*State) GetAmqp

func (s *State) GetAmqp(n string) *amqp2.Amqp

func (*State) GetAmqpNames

func (s *State) GetAmqpNames() []string

func (*State) GetMetrics

func (s *State) GetMetrics(n string) []*Metric

Jump to

Keyboard shortcuts

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