parser

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOWEST      int
	EQUALS      // =
	LOGICAL     // and, or, not
	LESSGREATER // > or < or <= or >=
	SUM         // +
	PRODUCT     // *
	PREFIX      // -X
	CALL        // func(x)
	INDEX       // array[index]

)

Precendence from lowest to highest

View Source
const (
	ProcessFieldType          = 1
	SampleFieldType           = 2
	ProcessAttributeFieldType = 3
	SampleAttributeFieldType  = 4
	ProcessFuncType           = 5
	SampleFuncType            = 6
)

Variables

View Source
var ErrInvalidWhereStatement = errors.New("invalid where statement")
View Source
var ErrNoSelectionStatement = errors.New("no selection statement")

Functions

func HasProcessMatchStatement

func HasProcessMatchStatement(statement Statement) bool

func HasSampleMatchStatement

func HasSampleMatchStatement(statement Statement) bool

Types

type AndStatement

type AndStatement struct {
	// Ignored field that is here to distinguish json from "OrStatement"
	And   int       `json:"and"`
	Left  Statement `json:"left"`
	Right Statement `json:"right"`
}

type MatchStatement

type MatchStatement struct {
	FieldType int         `json:"field_type"`
	FieldName string      `json:"field_name"`
	Operation string      `json:"operation"`
	Value     interface{} `json:"value"`
}

type OrStatement

type OrStatement struct {
	// Ignored field that is here to distinguish json from "AndStatement"
	Or    int       `json:"or"`
	Left  Statement `json:"left"`
	Right Statement `json:"right"`
}

type Parser

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

func New

func New(l *lexer.Lexer) *Parser

func (*Parser) ParseMQL

func (p *Parser) ParseMQL() *ast.MQL

type Selection

type Selection struct {
	SelectProcesses bool
	SelectSamples   bool
	Statement       Statement
}

func AST2Selection

func AST2Selection(query *ast.MQL) (*Selection, error)

type Statement

type Statement interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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