Documentation
¶
Overview ¶
Package expression provides utilities to evaluate expressions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToJSONStandard ¶ added in v0.2.0
func ToJSONStandard(v interface{}) (interface{}, error)
ToJSONStandard converts the given value to a value that used by gojq.
Types ¶
type DurationGetter ¶
type DurationGetter interface { // Get returns a duration value. Get(ctx context.Context, v interface{}, now time.Time) (time.Duration, bool) }
DurationGetter is a interface that can be used to get a time.Duration value.
func NewDurationFrom ¶
func NewDurationFrom(value *time.Duration, src *string) (DurationGetter, error)
NewDurationFrom returns a new DurationGetter.
type IntGetter ¶ added in v0.6.0
type IntGetter interface { // Get returns a int64 value. Get(ctx context.Context, v interface{}) (int64, bool) }
IntGetter is a interface that can be used to get a int64 value.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is wrapper of gojq.Query.
type Requirement ¶
type Requirement struct {
// contains filtered or unexported fields
}
Requirement contains values, a key, and an operator that relates the key and values. The zero value of Requirement is invalid.
func NewRequirement ¶
func NewRequirement(key string, op internalversion.SelectorOperator, vals []string) (*Requirement, error)
NewRequirement is the constructor for a Requirement.
func (*Requirement) Matches ¶
func (r *Requirement) Matches(ctx context.Context, matchData interface{}) (bool, error)
Matches returns true if the Requirement matches the input Labels. There is a match in the following cases: - the operator is 'In' and the value is in the set of values - the operator is 'NotIn' and the value is not in the set of values - the operator is 'Exists' and the key is defined and has a non-empty value - the operator is 'DoesNotExist' and the key is either not defined or has an empty value