kvfilters

package
v0.0.0-...-6e0b544 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidEffect Effect = 0
	Omit                 = 'o'
	Keep                 = 'k'
)
View Source
const (
	InvalidComparison Comparison = 0
	Equals                       = '='
	NotEquals                    = '!'
	IsTrue                       = Equals
	IsFalse                      = NotEquals
	IsMatched                    = Equals
	NotMatched                   = NotEquals
)
View Source
const (
	InvalidTarget Target = 0
	Groups               = 'g'
	Keys                 = 'k'
	Values               = 'v'
	KeyValues            = 'b' // b=both
)
View Source
const (
	InvalidMatches Matches = 0
	Prefix                 = 'p'
	Suffix                 = 's'
	Entirety               = 'e'
	Func                   = 'f'
	Regexp                 = 'r'
	Contains               = 'c'
)

Variables

View Source
var (
	ErrUnknown                      = errors.New("unknown")
	ErrFailedToAccessGroupKeyValues = errors.New("failed to access key values for group")
	ErrFailedToInitializeGroup      = errors.New("failed to initialize group")
	ErrFailedTypeAssertion          = errors.New("invalid type assertion")
	ErrInvalidRegExp                = errors.New("invalid regexp")
	ErrInvalidFilterMatchCriteria   = errors.New("invalid filter match criteria")
)
View Source
var KeyValueOrKeyValue = []Target{Keys, Values, KeyValues}

Functions

func MustKeepGroup

func MustKeepGroup(ff []Filter, group Name, targets ...Target) (keep bool, err error)

MustKeepGroup returns true is a value matches ANY Keep kvfilters. Rarely use this as it overrides all Omit kvfilters.

func MustKeepKeyValue2

func MustKeepKeyValue2(ff []Filter, key Code, value string, targets ...Target) (keep bool, err error)

MustKeepKeyValue2 returns true is a key or value as appropriate matches ANY Keep kvfilters.

func OmitGroup

func OmitGroup(ff []Filter, group Name, targets ...Target) (omit bool, err error)

OmitGroup returns true if there is a match for ANY Omit kvfilters.

func OmitKeyValue2

func OmitKeyValue2(ff []Filter, key Code, value string, targets ...Target) (omit bool, err error)

OmitKeyValue2 returns true is a key or value as appropriate matches ANY Omit kvfilters.

Types

type Code

type Code = types.Code

Code is the camel-cased version of name without spaces used for comparison, e.g. "userManaged" instead of "User Managed."

func Codify

func Codify(s string) Code

type Comparison

type Comparison byte

type Effect

type Effect byte

type Filter

type Filter interface {
	Effect() Effect
	Target() Target
	Comparison() Comparison
	Matches() Matches
	IgnoreCase() bool
}

func MontereyQueryFilters

func MontereyQueryFilters() []Filter

func SequoiaQueryFilters

func SequoiaQueryFilters() []Filter

type Funcs1Getter

type Funcs1Getter interface {
	Funcs1() []MatchFunc1
}

type Funcs2Getter

type Funcs2Getter interface {
	Funcs2() []MatchFunc2
}

type Group

type Group interface {
	Name() Name
	Code() Code
	KeyValues() []KeyValue
	AddKeyValue(KeyValue)
	LogArgs() []any
	ErrorInfo() error
	ShallowCopy() Group
	Valid() bool
	fmt.Stringer
}

func NewGroupFromGroup

func NewGroupFromGroup(g Group) Group

NewGroupFromGroup creates a new group from an existing one w/o copying its keyValues

func Query

func Query(args QueryArgs) (result []Group, err error)

func QueryGroups

func QueryGroups(args QueryArgs) (result []Group, err error)

type KeepWhenGroupIsOneOf

type KeepWhenGroupIsOneOf []string

type KeepWhenGroupIsOneOfIgnoringCase

type KeepWhenGroupIsOneOfIgnoringCase []string

type KeepWhenKeyIsOneOf

type KeepWhenKeyIsOneOf []string

type KeepWhenKeyIsOneOfIgnoringCase

type KeepWhenKeyIsOneOfIgnoringCase []string

type KeepWhenKeyPrefixIsOneOf

type KeepWhenKeyPrefixIsOneOf []string

type KeyValue

type KeyValue interface {
	fmt.Stringer
	Key() Code
	Value() string
	Labels() *Labels
	ErrorInfo() error
	Valid() bool
}

type Label

type Label struct {
	Name      LabelName
	Value     LabelValue
	IsUnknown bool
}

func NewLabel

func NewLabel(name LabelName, value LabelValue) Label

func NewUnknownLabel

func NewUnknownLabel(name LabelName, value LabelValue) Label

func (Label) String

func (l Label) String() string

type LabelName

type LabelName Name

func (LabelName) String

func (name LabelName) String() string

type LabelValue

type LabelValue string

func (LabelValue) String

func (value LabelValue) String() string

type Labels

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

func NewLabels

func NewLabels(labels ...*Label) *Labels

func (*Labels) ContainsAny

func (ll *Labels) ContainsAny(labels ...*Label) (contains bool)

func (*Labels) DeleteNamedLabel

func (ll *Labels) DeleteNamedLabel(name LabelName)

DeleteNamedLabel removes the label that has the passed label name.

func (*Labels) Equivalent

func (ll *Labels) Equivalent(labels *Labels) (eq bool)

func (*Labels) GetNamedLabel

func (ll *Labels) GetNamedLabel(name LabelName) *Label

func (*Labels) HasLabel

func (ll *Labels) HasLabel(label *Label) bool

HasLabel returns true if `*Labels` has the passed label

func (*Labels) HasNamedLabel

func (ll *Labels) HasNamedLabel(name LabelName) bool

HasNamedLabel returns true if `*Labels` has a label with the passed label name

func (*Labels) LabelPtrs

func (ll *Labels) LabelPtrs() []*Label

func (*Labels) SetLabel

func (ll *Labels) SetLabel(label *Label)

func (*Labels) String

func (ll *Labels) String() string

func (*Labels) SyncMap

func (ll *Labels) SyncMap()

func (*Labels) Valid

func (ll *Labels) Valid() (ok bool)

type MatchFunc1

type MatchFunc1 func(Code) bool

type MatchFunc2

type MatchFunc2 func(Code, string) bool

type Matches

type Matches byte

func (Matches) String

func (m Matches) String() string

type Name

type Name = types.Name

Name for the group or key-value pair, or anything else that needs a name.

type OmitWhenGroupContainsOneOf

type OmitWhenGroupContainsOneOf []string

type OmitWhenGroupContainsOneOfIgnoringCase

type OmitWhenGroupContainsOneOfIgnoringCase []string

type OmitWhenGroupIsNotOneOf

type OmitWhenGroupIsNotOneOf []string

type OmitWhenGroupIsOneOf

type OmitWhenGroupIsOneOf []string

type OmitWhenGroupPassedToFuncReturnsFalse

type OmitWhenGroupPassedToFuncReturnsFalse []MatchFunc1

type OmitWhenGroupPassedToFuncReturnsFalseIgnoringCase

type OmitWhenGroupPassedToFuncReturnsFalseIgnoringCase []MatchFunc1

type OmitWhenGroupPassedToFuncReturnsTrue

type OmitWhenGroupPassedToFuncReturnsTrue []MatchFunc1

type OmitWhenGroupPassedToFuncReturnsTrueIgnoringCase

type OmitWhenGroupPassedToFuncReturnsTrueIgnoringCase []MatchFunc1

type OmitWhenGroupPrefixIsNotOneOf

type OmitWhenGroupPrefixIsNotOneOf []string

type OmitWhenGroupPrefixIsNotOneOfIgnoringCase

type OmitWhenGroupPrefixIsNotOneOfIgnoringCase []string

type OmitWhenGroupPrefixIsOneOf

type OmitWhenGroupPrefixIsOneOf []string

type OmitWhenGroupPrefixIsOneOfIgnoringCase

type OmitWhenGroupPrefixIsOneOfIgnoringCase []string

type OmitWhenGroupSuffixIsOneOf

type OmitWhenGroupSuffixIsOneOf []string

type OmitWhenGroupSuffixIsOneOfIgnoringCase

type OmitWhenGroupSuffixIsOneOfIgnoringCase []string

type OmitWhenKeyContainsOneOf

type OmitWhenKeyContainsOneOf []string

type OmitWhenKeyContainsOneOfIgnoringCase

type OmitWhenKeyContainsOneOfIgnoringCase []string

type OmitWhenKeyIsOneOf

type OmitWhenKeyIsOneOf []string

type OmitWhenKeyIsOneOfIgnoringCase

type OmitWhenKeyIsOneOfIgnoringCase []string

type OmitWhenKeyMatchedByRegexp

type OmitWhenKeyMatchedByRegexp []string

type OmitWhenKeyMatchedByRegexpIgnoringCase

type OmitWhenKeyMatchedByRegexpIgnoringCase []string

type OmitWhenKeyPassedToFuncReturnsFalse

type OmitWhenKeyPassedToFuncReturnsFalse []MatchFunc1

type OmitWhenKeyPassedToFuncReturnsFalseIgnoringCase

type OmitWhenKeyPassedToFuncReturnsFalseIgnoringCase []MatchFunc1

type OmitWhenKeyPassedToFuncReturnsTrue

type OmitWhenKeyPassedToFuncReturnsTrue []MatchFunc1

type OmitWhenKeyPassedToFuncReturnsTrueIgnoringCase

type OmitWhenKeyPassedToFuncReturnsTrueIgnoringCase []MatchFunc1

type OmitWhenKeyPrefixIsNotOneOf

type OmitWhenKeyPrefixIsNotOneOf []string

type OmitWhenKeyPrefixIsNotOneOfIgnoringCase

type OmitWhenKeyPrefixIsNotOneOfIgnoringCase []string

type OmitWhenKeyPrefixIsOneOf

type OmitWhenKeyPrefixIsOneOf []string

type OmitWhenKeyPrefixIsOneOfIgnoringCase

type OmitWhenKeyPrefixIsOneOfIgnoringCase []string

type OmitWhenKeySuffixIsNotOneOf

type OmitWhenKeySuffixIsNotOneOf []string

type OmitWhenKeySuffixIsNotOneOfIgnoringCase

type OmitWhenKeySuffixIsNotOneOfIgnoringCase []string

type OmitWhenKeySuffixIsOneOf

type OmitWhenKeySuffixIsOneOf []string

type OmitWhenKeySuffixIsOneOfIgnoringCase

type OmitWhenKeySuffixIsOneOfIgnoringCase []string

type OmitWhenValueMatchedByOneOfRegexps

type OmitWhenValueMatchedByOneOfRegexps []string

type OmitWhenValueMatchedByOneOfRegexpsIgnoringCase

type OmitWhenValueMatchedByOneOfRegexpsIgnoringCase []string

type OmitWhenValueNotMatchedByOneOfRegexps

type OmitWhenValueNotMatchedByOneOfRegexps []string

type OmitWhenValueNotMatchedByOneOfRegexpsIgnoringCase

type OmitWhenValueNotMatchedByOneOfRegexpsIgnoringCase []string

type OmitWhenValuePassedToFuncReturnsFalse

type OmitWhenValuePassedToFuncReturnsFalse []MatchFunc1

type OmitWhenValuePassedToFuncReturnsFalseIgnoringCase

type OmitWhenValuePassedToFuncReturnsFalseIgnoringCase []MatchFunc1

type OmitWhenValuePassedToFuncReturnsTrue

type OmitWhenValuePassedToFuncReturnsTrue []MatchFunc1

type OmitWhenValuePassedToFuncReturnsTrueIgnoringCase

type OmitWhenValuePassedToFuncReturnsTrueIgnoringCase []MatchFunc1

type QueryArgs

type QueryArgs struct {
	Filters     []Filter
	Groups      []Group
	Labels      []*Label
	OmitEmpty   bool
	OmitInvalid bool
}

type Target

type Target byte

func (Target) String

func (t Target) String() string

type ValuesGetter

type ValuesGetter interface {
	Values() []string
}

Jump to

Keyboard shortcuts

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