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 IsTagKeyReserved ¶
func IsTagKeyRuneAllowed ¶
func ValidateAppName ¶
ValidateAppName report an error if the given app name n violates constraints.
func ValidateTagKey ¶
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 Op ¶
type Op int
const ( OpNotEqual Op // != OpNotEqualRegex // !~ OpEqual // = OpEqualRegex // =~ )
func (Op) IsNegation ¶
IsNegation reports whether the operator assumes negation.
type Query ¶
type Query struct { AppName string Matchers []*TagMatcher // contains filtered or unexported fields }
func ParseQuery ¶
ParseQuery parses a string of $app_name<{<$tag_matchers>}> form.
type TagMatcher ¶
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
Click to show internal directories.
Click to hide internal directories.