labelql

package module
v0.0.0-...-cee55b7 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Keywords = map[string]bool{
	"!":   true,
	"=":   true,
	"(":   true,
	")":   true,
	"AND": true,
	"OR":  true,
}

Functions

This section is empty.

Types

type Cond

type Cond struct {
	Operator CondOperator
	Left     Node
	Right    Node
}

func NewCond

func NewCond(op CondOperator, left Node, right Node) *Cond

func (*Cond) Match

func (c *Cond) Match(labels []*Label) bool

func (*Cond) String

func (c *Cond) String() string

type CondOperator

type CondOperator int
const (
	CondOperatorAND CondOperator = iota + 1
	CondOperatorOR
)

type Label

type Label struct {
	Key      string
	Value    string
	Operator string
}

func NewLabel

func NewLabel(key string, value string) *Label

func NewLabelWithOperator

func NewLabelWithOperator(key string, value string, op string) *Label

func (*Label) Equal

func (l *Label) Equal(targetLabel *Label) bool

func (*Label) Match

func (l *Label) Match(labels []*Label) bool

func (*Label) String

func (l *Label) String() string

type LabelQL

type LabelQL struct {
	Node
}

swagger:strfmt lql

func ParseLabelQL

func ParseLabelQL(lql string) (*LabelQL, error)

func (LabelQL) MarshalText

func (v LabelQL) MarshalText() ([]byte, error)

func (*LabelQL) Match

func (v *LabelQL) Match(labels []*Label) bool

func (*LabelQL) RangeLabel

func (v *LabelQL) RangeLabel(cb func(label *Label))

func (*LabelQL) UnmarshalText

func (v *LabelQL) UnmarshalText(data []byte) error

type Node

type Node interface {
	String() string
}

type Token

type Token struct {
	TokenText string
	Pos       scanner.Position
	IsKeyword bool
}

func NewToken

func NewToken(pos scanner.Position, tokenText string) *Token

type TokenScanner

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

func (*TokenScanner) Last

func (s *TokenScanner) Last() *Token

func (*TokenScanner) Push

func (s *TokenScanner) Push(token *Token)

func (*TokenScanner) Scan

func (s *TokenScanner) Scan() (Node, error)

Jump to

Keyboard shortcuts

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