flameql

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReservedTagKeyName = "__name__"
)

Variables

View Source
var (
	ErrInvalidQuerySyntax    = errors.New("invalid query syntax")
	ErrInvalidAppName        = errors.New("invalid application name")
	ErrInvalidMatchersSyntax = errors.New("invalid tag matchers syntax")
	ErrInvalidTagKey         = errors.New("invalid tag key")
	ErrInvalidTagValueSyntax = errors.New("invalid tag value syntax")

	ErrAppNameIsRequired = errors.New("application name is required")
	ErrTagKeyIsRequired  = errors.New("tag key is required")
	ErrTagKeyReserved    = errors.New("tag key is reserved")

	ErrMatchOperatorIsRequired = errors.New("match operator is required")
	ErrUnknownOp               = errors.New("unknown tag match operator")
)

Functions

func IsAppNameRuneAllowed

func IsAppNameRuneAllowed(r rune) bool

func IsTagKeyReserved

func IsTagKeyReserved(k string) bool

func IsTagKeyRuneAllowed

func IsTagKeyRuneAllowed(r rune) bool

func ValidateAppName

func ValidateAppName(n string) error

ValidateAppName report an error if the given app name n violates constraints.

func ValidateTagKey

func ValidateTagKey(k string) error

ValidateTagKey report an error if the given key k violates constraints.

The function should be used to validate user input. The function returns ErrTagKeyReserved if the key is valid but reserved for internal use.

Types

type ByPriority

type ByPriority []*TagMatcher

ByPriority is a supplemental type for sorting tag matchers.

func (ByPriority) Len

func (p ByPriority) Len() int

func (ByPriority) Less

func (p ByPriority) Less(i, j int) bool

func (ByPriority) Swap

func (p ByPriority) Swap(i, j int)

type Error

type Error struct {
	Inner error
	Expr  string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Op

type Op int
const (
	OpNotEqual      Op // !=
	OpNotEqualRegex    // !~
	OpEqual            // =
	OpEqualRegex       // =~
)

func (Op) IsNegation

func (o Op) IsNegation() bool

IsNegation reports whether the operator assumes negation.

type Query

type Query struct {
	AppName  string
	Matchers []*TagMatcher
	// contains filtered or unexported fields
}

func ParseQuery

func ParseQuery(s string) (*Query, error)

ParseQuery parses a string of $app_name<{<$tag_matchers>}> form.

func (*Query) String

func (q *Query) String() string

type TagMatcher

type TagMatcher struct {
	Key   string
	Value string
	Op

	R *regexp.Regexp
}

func ParseMatcher

func ParseMatcher(s string) (*TagMatcher, error)

ParseMatcher parses a string of $tag_key$op"$tag_value" form, where $op is one of the supported match operators.

func ParseMatchers

func ParseMatchers(s string) ([]*TagMatcher, error)

ParseMatchers parses a string of $tag_matcher<,$tag_matchers> form.

func (*TagMatcher) Match

func (m *TagMatcher) Match(v string) bool

Jump to

Keyboard shortcuts

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