fields

package
v0.0.9-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByKey

type ByKey []Requirement

ByKey sorts requirements by key to obtain deterministic parser

func (ByKey) Len

func (rs ByKey) Len() int

func (ByKey) Less

func (rs ByKey) Less(i, j int) bool

func (ByKey) Swap

func (rs ByKey) Swap(i, j int)

type Field

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

func NewField

func NewField(parentPath *field.Path, name string) Field

func (*Field) GetListIndex

func (f *Field) GetListIndex() (int, bool)

func (*Field) IsList

func (f *Field) IsList() bool

func (*Field) Name

func (f *Field) Name() string

func (*Field) Path

func (f *Field) Path() *field.Path

func (*Field) Validate

func (f *Field) Validate() *field.Error

type Lexer

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

Lexer represents the Lexer struct for label selector. It contains necessary informationt to tokenize the input string

func (*Lexer) Lex

func (l *Lexer) Lex() (tok labels.Token, lit string)

Lex returns a pair of Token and the literal literal is meaningfull only for IdentifierToken token

type Parser

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

type ParserContext

type ParserContext int

ParserContext represents context during parsing: some literal for example 'in' and 'notin' can be recognized as operator for example 'x in (a)' but it can be recognized as value for example 'value in (in)'

const (
	// KeyAndOperator represents key and operator
	KeyAndOperator ParserContext = iota
	// Values represents values
	Values
)

type Requirement

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

func NewRequirement

func NewRequirement(key string, op selection.Operator, vals []string) (*Requirement, error)

func (*Requirement) Fields

func (r *Requirement) Fields() []Field

func (*Requirement) Operator

func (r *Requirement) Operator() selection.Operator

func (*Requirement) String

func (r *Requirement) String() string

func (*Requirement) Values

func (r *Requirement) Values() sets.String

type Requirements

type Requirements []Requirement

type ScannedItem

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

ScannedItem contains the Token and the literal produced by the lexer.

type Selector

type Selector interface {
	Empty() bool

	String() string

	// Add adds requirements to the Selector
	Add(r ...Requirement) Selector

	Requirements() (requirements Requirements, selectable bool)

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

Selector represents a label selector

func Parse

func Parse(selector string) (Selector, error)

Jump to

Keyboard shortcuts

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