labels

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// a selector label takes precedance over any other label when matching
	RuleIncludeLabel = "konveyor.io/include"
	SelectAlways     = "always"
	SelectNever      = "never"
)
View Source
const (
	LabelValueFmt  = "^[a-zA-Z0-9]([-a-zA-Z0-9. ]*[a-zA-Z0-9+-])?$"
	LabelPrefixFmt = "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$"
)

Variables

This section is empty.

Functions

func AsString

func AsString(key, value string) string

Helper function to refactor key value label manipulation

func ParseLabel

func ParseLabel(label string) (string, string, error)

ParseLabel given a string label converts into key=val

func ParseLabels

func ParseLabels(labels []string) (map[string][]string, error)

ParseLabels given a list of string labels, returns them as key=[val] map a list of values is needed because keys can be duplicate

Types

type LabelSelector

type LabelSelector[T Labeled] struct {
	// contains filtered or unexported fields
}

func NewLabelSelector

func NewLabelSelector[T Labeled](expr string, match MatchAny) (*LabelSelector[T], error)

NewRuleSelector returns a new rule selector that works on rule labels it enables using string expressions to form complex label queries supports "&&", "||" and "!" operators, "(" ")" for grouping, operands are string labels in key=val format, keys can be subdomain prefixed

func (*LabelSelector[T]) MatchList

func (l *LabelSelector[T]) MatchList(list []T) ([]T, error)

func (*LabelSelector[T]) Matches

func (l *LabelSelector[T]) Matches(v T) (bool, error)

type Labeled

type Labeled interface {
	GetLabels() []string
}

type MatchAny

type MatchAny func(elem string, items []string) bool

Jump to

Keyboard shortcuts

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