Documentation ¶
Index ¶
- func Compare(a, b Labels) int
- type EqualMatcher
- type Label
- type Labels
- func (ls Labels) Equals(o Labels) bool
- func (ls Labels) Get(name string) string
- func (ls Labels) Hash() uint64
- func (ls Labels) Len() int
- func (ls Labels) Less(i, j int) bool
- func (ls Labels) Map() map[string]string
- func (ls Labels) String() string
- func (ls Labels) Swap(i, j int)
- func (ls Labels) WithoutEmpty() Labels
- type Matcher
- type NotMatcher
- type RegexpMatcher
- type Selector
- type Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EqualMatcher ¶
type EqualMatcher struct {
// contains filtered or unexported fields
}
EqualMatcher matches on equality.
func (EqualMatcher) Matches ¶
func (m EqualMatcher) Matches(v string) bool
Matches implements Matcher interface.
func (EqualMatcher) String ¶
func (m EqualMatcher) String() string
String implements Matcher interface.
type Labels ¶
type Labels []Label
Labels is a sorted set of labels. Order has to be guaranteed upon instantiation.
func FromStrings ¶
FromStrings creates new labels from pairs of strings.
func New ¶
New returns a sorted Labels from the given labels. The caller has to guarantee that all label names are unique.
func ReadLabels ¶
ReadLabels reads up to n label sets in a JSON formatted file fn. It is mostly useful to load testing data.
func (Labels) Get ¶
Get returns the value for the label with the given name. Returns an empty string if the label doesn't exist.
func (Labels) WithoutEmpty ¶
WithoutEmpty returns the labelset without empty labels. May return the same labelset.
type Matcher ¶
type Matcher interface { // Name returns the label name the matcher should apply to. Name() string // Matches checks whether a value fulfills the constraints. Matches(v string) bool // String returns a human readable matcher. String() string }
Matcher specifies a constraint for the value of a label.
func NewEqualMatcher ¶
NewEqualMatcher returns a new matcher matching an exact label value.
func NewMustRegexpMatcher ¶
NewMustRegexpMatcher returns a new matcher verifying that a value matches the regular expression pattern. Will panic if the pattern is not a valid regular expression.
func NewRegexpMatcher ¶
NewRegexpMatcher returns a new matcher verifying that a value matches the regular expression pattern.
type NotMatcher ¶
type NotMatcher struct {
Matcher
}
NotMatcher inverts the matching result for a matcher.
func (NotMatcher) Matches ¶
func (m NotMatcher) Matches(v string) bool
func (NotMatcher) String ¶
func (m NotMatcher) String() string
type RegexpMatcher ¶
type RegexpMatcher struct {
// contains filtered or unexported fields
}
func (RegexpMatcher) Matches ¶
func (m RegexpMatcher) Matches(v string) bool
func (RegexpMatcher) Name ¶
func (m RegexpMatcher) Name() string
func (RegexpMatcher) String ¶
func (m RegexpMatcher) String() string
func (RegexpMatcher) Value ¶
func (m RegexpMatcher) Value() string