Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicPredicate ¶
type AtomicPredicate struct {
Negated bool `json:"negated,omitempty"`
LHS string `json:"lhs"`
Op ComparisonOp `json:"op"`
RHS any `json:"rhs"`
}
AtomicPredicate compares one observation field with a right-hand value.
func (AtomicPredicate) Evaluate ¶
func (p AtomicPredicate) Evaluate(observation Observation) (bool, error)
func (AtomicPredicate) String ¶
func (p AtomicPredicate) String() string
type BinaryPredicate ¶
type BinaryPredicate struct {
LHS Predicate `json:"-"`
Op BinaryOp `json:"op"`
RHS Predicate `json:"-"`
}
BinaryPredicate combines two predicates with boolean AND or OR.
func (BinaryPredicate) Evaluate ¶
func (p BinaryPredicate) Evaluate(observation Observation) (bool, error)
func (BinaryPredicate) String ¶
func (p BinaryPredicate) String() string
type ComparisonOp ¶
type ComparisonOp string
ComparisonOp is a supported atomic predicate comparison.
const ( OpEQ ComparisonOp = "==" OpNEQ ComparisonOp = "!=" OpGT ComparisonOp = ">" OpLT ComparisonOp = "<" OpGTE ComparisonOp = ">=" OpLTE ComparisonOp = "<=" )
type Observation ¶
Observation is the default map shape used by predicates.
type Predicate ¶
type Predicate interface {
Evaluate(observation Observation) (bool, error)
String() string
}
Predicate evaluates a boolean property over one observation.
type QuantifiedPredicate ¶
type QuantifiedPredicate struct {
Quantifier Quantifier
Predicate Predicate
}
QuantifiedPredicate evaluates a predicate over multiple object observations.
func (QuantifiedPredicate) Evaluate ¶
func (p QuantifiedPredicate) Evaluate(observations []Observation) (bool, error)
func (QuantifiedPredicate) String ¶
func (p QuantifiedPredicate) String() string
type Quantifier ¶
type Quantifier string
Quantifier determines how a predicate is evaluated over a slice of objects.
const ( QuantifierExists Quantifier = "exist" QuantifierAll Quantifier = "all" )
Click to show internal directories.
Click to hide internal directories.