expression

package
v0.0.0-...-ed06964 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpressionResolution error = errors.New("resolution error")
View Source
var ErrInvalidSyntax error = errors.New("invalid syntax")
View Source
var ErrNoMatch error = errors.New("no match")

Functions

This section is empty.

Types

type Array

type Array struct {
	Items []*Term `"[" ( @@ ("," @@ )* )? "]"`
}

type Attribute

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

func NewAttribute

func NewAttribute(name string) Attribute

func (*Attribute) Capture

func (a *Attribute) Capture(in []string) error

func (*Attribute) IsMeta

func (a *Attribute) IsMeta() bool

func (*Attribute) Name

func (a *Attribute) Name() string

type AttributeDataStore

type AttributeDataStore struct {
	Span traces.Span
}

func (AttributeDataStore) Get

func (ds AttributeDataStore) Get(name string) (string, error)

func (AttributeDataStore) Source

func (ds AttributeDataStore) Source() string

type DataStore

type DataStore interface {
	Source() string
	Get(name string) (string, error)
}

type Duration

type Duration string

func (*Duration) Capture

func (a *Duration) Capture(in []string) error

type Environment

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

func (*Environment) Capture

func (e *Environment) Capture(in []string) error

func (*Environment) Name

func (e *Environment) Name() string

type Executor

type Executor struct {
	Stores map[string]DataStore
}

func NewExecutor

func NewExecutor(dataStores ...DataStore) Executor

func (Executor) Expression

func (e Executor) Expression(expression string) (value.Value, error)

func (Executor) GetParsedStatement

func (e Executor) GetParsedStatement(statement string) (Statement, error)

func (Executor) ResolveExpression

func (e Executor) ResolveExpression(expr *Expr) (value.Value, error)

func (Executor) ResolveStatement

func (e Executor) ResolveStatement(statement string) (string, error)

func (Executor) Statement

func (e Executor) Statement(statement string) (string, string, error)

type Expr

type Expr struct {
	Left    *Term     `@@`
	Right   []*OpTerm `@@*`
	Filters []*Filter `@@*`
}

func Parse

func Parse(expression string) (Expr, error)

type ExpressionOperation

type ExpressionOperation func(types.TypedValue, types.TypedValue) (types.TypedValue, error)

type Filter

type Filter struct {
	Name string  `"|" @Ident`
	Args []*Term `@@*`
}

type FunctionCall

type FunctionCall struct {
	Name string  `@Ident`
	Args []*Term `"(" ( @@ ("," @@ )* )? ")"`
}

type InvalidSyntaxError

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

func (*InvalidSyntaxError) Error

func (e *InvalidSyntaxError) Error() string

func (*InvalidSyntaxError) Is

func (e *InvalidSyntaxError) Is(target error) bool

func (*InvalidSyntaxError) Unwrap

func (e *InvalidSyntaxError) Unwrap() error

type MetaAttributesDataStore

type MetaAttributesDataStore struct {
	SelectedSpans []traces.Span
}

func (MetaAttributesDataStore) Get

func (ds MetaAttributesDataStore) Get(name string) (string, error)

func (MetaAttributesDataStore) Source

func (ds MetaAttributesDataStore) Source() string

type OpTerm

type OpTerm struct {
	Operator string `@Operator`
	Term     *Term  `@@`
}

type OperationRegistry

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

func (*OperationRegistry) Add

func (r *OperationRegistry) Add(name string, operation ExpressionOperation)

func (*OperationRegistry) Get

type ResolutionError

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

func (*ResolutionError) Error

func (e *ResolutionError) Error() string

func (*ResolutionError) Is

func (e *ResolutionError) Is(target error) bool

func (*ResolutionError) Unwrap

func (e *ResolutionError) Unwrap() error

type Statement

type Statement struct {
	Left       *Expr  `@@`
	Comparator string `@Comparator`
	Right      *Expr  `@@`
}

func ParseStatement

func ParseStatement(statement string) (Statement, error)

type Str

type Str struct {
	Text string
	Args []Expr
}

func (*Str) Capture

func (s *Str) Capture(in []string) error

type Term

type Term struct {
	FunctionCall *FunctionCall `( @@`
	Array        *Array        `| @@`
	Duration     *Duration     `| @Duration `
	Number       *string       `| @Number `
	Attribute    *Attribute    `| @Attribute `
	Environment  *Environment  `| @Environment `
	Variable     *Variable     `| @Variable `
	Str          *Str          `| @(QuotedString|SingleQuotedString) )`
}

func (*Term) Type

func (term *Term) Type() TermType

type TermType

type TermType = string
const (
	FunctionCallType TermType = "FunctionCall"
	ArrayType        TermType = "Array"
	DurationType     TermType = "Duration"
	NumberType       TermType = "Number"
	AttributeType    TermType = "Attribute"
	EnvironmentType  TermType = "Environment"
	VariableType     TermType = "Variable"
	StrType          TermType = "Str"
)

type Token

type Token struct {
	Identifier string
	Type       TermType
}

func GetTokens

func GetTokens(statement string) ([]Token, error)

func GetTokensFromExpression

func GetTokensFromExpression(expression string) ([]Token, error)

type Variable

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

func NewEnvironment

func NewEnvironment(name string) Variable

func NewVariable

func NewVariable(name string) Variable

func (*Variable) Capture

func (v *Variable) Capture(in []string) error

func (*Variable) Name

func (v *Variable) Name() string

type VariableDataStore

type VariableDataStore struct {
	Values []variableset.VariableSetValue
}

func (VariableDataStore) Get

func (ds VariableDataStore) Get(name string) (string, error)

func (VariableDataStore) Source

func (ds VariableDataStore) Source() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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