apimachinery: k8s.io/apimachinery/pkg/fields Index | Files

package fields

import "k8s.io/apimachinery/pkg/fields"

Package fields implements a simple field system, parsing and matching selectors with sets of fields.

Index

Package Files

doc.go fields.go requirements.go selector.go

func EscapeValue Uses

func EscapeValue(s string) string

EscapeValue escapes an arbitrary literal string for use as a fieldSelector value

func UnescapeValue Uses

func UnescapeValue(s string) (string, error)

UnescapeValue unescapes a fieldSelector value and returns the original literal value. May return the original string if it contains no escaped or special characters.

type Fields Uses

type Fields interface {
    // Has returns whether the provided field exists.
    Has(field string) (exists bool)

    // Get returns the value for the provided field.
    Get(field string) (value string)
}

Fields allows you to present fields independently from their storage.

type InvalidEscapeSequence Uses

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

InvalidEscapeSequence indicates an error occurred unescaping a field selector

func (InvalidEscapeSequence) Error Uses

func (i InvalidEscapeSequence) Error() string

type Requirement Uses

type Requirement struct {
    Operator selection.Operator
    Field    string
    Value    string
}

Requirement contains a field, a value, and an operator that relates the field and value. This is currently for reading internal selection information of field selector.

type Requirements Uses

type Requirements []Requirement

Requirements is AND of all requirements.

type Selector Uses

type Selector interface {
    // Matches returns true if this selector matches the given set of fields.
    Matches(Fields) bool

    // Empty returns true if this selector does not restrict the selection space.
    Empty() bool

    // RequiresExactMatch allows a caller to introspect whether a given selector
    // requires a single specific field to be set, and if so returns the value it
    // requires.
    RequiresExactMatch(field string) (value string, found bool)

    // Transform returns a new copy of the selector after TransformFunc has been
    // applied to the entire selector, or an error if fn returns an error.
    // If for a given requirement both field and value are transformed to empty
    // string, the requirement is skipped.
    Transform(fn TransformFunc) (Selector, error)

    // Requirements converts this interface to Requirements to expose
    // more detailed selection information.
    Requirements() Requirements

    // String returns a human readable string that represents this selector.
    String() string

    // Make a deep copy of the selector.
    DeepCopySelector() Selector
}

Selector represents a field selector.

func AndSelectors Uses

func AndSelectors(selectors ...Selector) Selector

AndSelectors creates a selector that is the logical AND of all the given selectors

func Everything Uses

func Everything() Selector

Everything returns a selector that matches all fields.

func Nothing Uses

func Nothing() Selector

Nothing returns a selector that matches no fields

func OneTermEqualSelector Uses

func OneTermEqualSelector(k, v string) Selector

OneTermEqualSelector returns an object that matches objects where one field/field equals one value. Cannot return an error.

func OneTermNotEqualSelector Uses

func OneTermNotEqualSelector(k, v string) Selector

OneTermNotEqualSelector returns an object that matches objects where one field/field does not equal one value. Cannot return an error.

func ParseAndTransformSelector Uses

func ParseAndTransformSelector(selector string, fn TransformFunc) (Selector, error)

ParseAndTransformSelector parses the selector and runs them through the given TransformFunc.

func ParseSelector Uses

func ParseSelector(selector string) (Selector, error)

ParseSelector takes a string representing a selector and returns an object suitable for matching, or an error.

func ParseSelectorOrDie Uses

func ParseSelectorOrDie(s string) Selector

ParseSelectorOrDie takes a string representing a selector and returns an object suitable for matching, or panic when an error occur.

func SelectorFromSet Uses

func SelectorFromSet(ls Set) Selector

SelectorFromSet returns a Selector which will match exactly the given Set. A nil Set is considered equivalent to Everything().

type Set Uses

type Set map[string]string

Set is a map of field:value. It implements Fields.

func (Set) AsSelector Uses

func (ls Set) AsSelector() Selector

AsSelector converts fields into a selectors.

func (Set) Get Uses

func (ls Set) Get(field string) string

Get returns the value in the map for the provided field.

func (Set) Has Uses

func (ls Set) Has(field string) bool

Has returns whether the provided field exists in the map.

func (Set) String Uses

func (ls Set) String() string

String returns all fields listed as a human readable string. Conveniently, exactly the format that ParseSelector takes.

type TransformFunc Uses

type TransformFunc func(field, value string) (newField, newValue string, err error)

TransformFunc transforms selectors.

type UnescapedRune Uses

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

UnescapedRune indicates an error occurred unescaping a field selector

func (UnescapedRune) Error Uses

func (i UnescapedRune) Error() string

Package fields imports 5 packages (graph) and is imported by 1463 packages. Updated 2019-08-15. Refresh now. Tools for package owners.