Documentation
¶
Overview ¶
Package impl defines all the support predicates and transformation function as individual functions that are then forwarded through code generation to the Builder type.
Index ¶
- func All(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
- func Any(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
- func AsError(target interface{}) (desc string, f predicate.TransformFunc)
- func Capacity() (desc string, f predicate.TransformFunc)
- func Contains(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func EndsWith(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Eq(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Eval(desc string, f predicate.TransformFunc) (string, predicate.TransformFunc)
- func Field(keypath string) (desc string, f predicate.TransformFunc)
- func Ge(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Gt(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func HasPrefix(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func HasSuffix(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Is(desc string, f predicate.PredicateFunc) (string, predicate.PredicateFunc)
- func IsCloseTo(rhs interface{}, tolerance float64) (desc string, f predicate.PredicateFunc)
- func IsDisjointSetFrom(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsEmpty() (desc string, f predicate.PredicateFunc)
- func IsEqualSet(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsError(expected any) (desc string, f predicate.PredicateFunc)
- func IsFalse() (desc string, f predicate.PredicateFunc)
- func IsGreaterOrEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsGreaterThan(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsLessOrEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsLessThan(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsNil() (desc string, f predicate.PredicateFunc)
- func IsNotEmpty() (desc string, f predicate.PredicateFunc)
- func IsNotEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsNotNil() (desc string, f predicate.PredicateFunc)
- func IsSubsetOf(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsSupersetOf(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func IsTrue() (desc string, f predicate.PredicateFunc)
- func Le(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Length() (desc string, f predicate.TransformFunc)
- func Lt(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func MapKeys() (desc string, f predicate.TransformFunc)
- func MapValues() (desc string, f predicate.TransformFunc)
- func Matches(re string) (desc string, f predicate.PredicateFunc)
- func Ne(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func Panics() (desc string, f predicate.PredicateFunc)
- func PanicsAndRecoveredValue() (desc string, f predicate.TransformFunc)
- func Passes(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
- func StartsWith(rhs interface{}) (desc string, f predicate.PredicateFunc)
- func ToLower() (desc string, f predicate.TransformFunc)
- func ToString() (desc string, f predicate.TransformFunc)
- func ToUpper() (desc string, f predicate.TransformFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
All tests if all values of a collection match the given predicate
func Any ¶
func Any(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
Any tests if at least one values of a collection match the given predicate
func AsError ¶ added in v1.3.0
func AsError(target interface{}) (desc string, f predicate.TransformFunc)
AsError tests if a value is an error matching or wrapping the expected error (according to go 1.13 error.As()) and returns the unwrapped error for further evaluation.
func Capacity ¶
func Capacity() (desc string, f predicate.TransformFunc)
Capacity is a transformation predicate that extract the capacity of a value for further evaluation. It applies to values of type Array, Slice and Channel.
func Contains ¶
func Contains(rhs interface{}) (desc string, f predicate.PredicateFunc)
Contains tests if a sequence value contains the given sequence, and can be applied to strings, arrays and slices.
func EndsWith ¶
func EndsWith(rhs interface{}) (desc string, f predicate.PredicateFunc)
EndsWith tests if a sequence value ends with the given sequence, and can be applied to strings, arrays and slices.
func Eq ¶
func Eq(rhs interface{}) (desc string, f predicate.PredicateFunc)
Eq tests if a value is equatable and equal to the specified value.
func Eval ¶
func Eval(desc string, f predicate.TransformFunc) (string, predicate.TransformFunc)
Eval is an extension point allowing for the definition of custom transformation functions in a predicate chain
func Field ¶
func Field(keypath string) (desc string, f predicate.TransformFunc)
Field is a transformation predicate that extract a field from a struct or a value from a map, identified by the given `keypath`. See value.Field() for more details.
func Ge ¶
func Ge(rhs interface{}) (desc string, f predicate.PredicateFunc)
Ge tests if a value is greater than or equal to a reference value
func Gt ¶
func Gt(rhs interface{}) (desc string, f predicate.PredicateFunc)
Gt tests if a value is strictly greater than a reference value
func HasPrefix ¶
func HasPrefix(rhs interface{}) (desc string, f predicate.PredicateFunc)
HasPrefix tests if a sequence value starts with the given sequence, and can be applied to strings, arrays and slices.
func HasSuffix ¶
func HasSuffix(rhs interface{}) (desc string, f predicate.PredicateFunc)
HasSuffix tests if a sequence value ends with the given sequence, and can be applied to strings, arrays and slices.
func Is ¶
func Is(desc string, f predicate.PredicateFunc) (string, predicate.PredicateFunc)
Is is an extension point allowing for the definition of a custom predicate function to evaluate a predicate chain
func IsCloseTo ¶
func IsCloseTo(rhs interface{}, tolerance float64) (desc string, f predicate.PredicateFunc)
IsCloseTo tests if a value is within tolerance of a reference value
func IsDisjointSetFrom ¶
func IsDisjointSetFrom(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsDisjointSetFrom tests if two containers contain no common values
func IsEmpty ¶
func IsEmpty() (desc string, f predicate.PredicateFunc)
IsEmpty tests if a sequence or container is empty.
func IsEqualSet ¶
func IsEqualSet(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsEqualSet tests if two containers contain the same set of values, independently of order.
func IsEqualTo ¶
func IsEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsEqualTo tests if a value is equatable and equal to the specified value.
func IsError ¶
func IsError(expected any) (desc string, f predicate.PredicateFunc)
IsError tests an error value to be either nil, a specific error according to `errors.Is()`, or an error whose message contains a specified string or matches a regexp. `.IsError("")` matches any error whose message contains an empty string, which is any non-nil error.
func IsFalse ¶
func IsFalse() (desc string, f predicate.PredicateFunc)
IsFalse tests if a value is false
func IsGreaterOrEqualTo ¶
func IsGreaterOrEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsGreaterOrEqualTo tests if a value is greater than or equal to a reference value
func IsGreaterThan ¶
func IsGreaterThan(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsGreaterThan tests if a value is strictly greater than a reference value
func IsLessOrEqualTo ¶
func IsLessOrEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsLessOrEqualTo tests if a value is less than or equal to a reference value
func IsLessThan ¶
func IsLessThan(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsLessThan tests if a value is strictly less than a reference value
func IsNil ¶
func IsNil() (desc string, f predicate.PredicateFunc)
IsNil tests if a value is either a nil literal or a nillable type set to nil
func IsNotEmpty ¶
func IsNotEmpty() (desc string, f predicate.PredicateFunc)
IsNotEmpty tests if a sequence or container is not empty.
func IsNotEqualTo ¶
func IsNotEqualTo(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsNotEqualTo tests if a value is equatable but different from the specified value.
func IsNotNil ¶
func IsNotNil() (desc string, f predicate.PredicateFunc)
IsNotNil tests if a value is neither a nil literal nor a nillable type set to nil; any value of a non-nillable type is considered not nil.
func IsSubsetOf ¶
func IsSubsetOf(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsSubsetOf tests if the value under test is a subset of the reference value. Both values must be containers and are treated as unordered sets.
func IsSupersetOf ¶
func IsSupersetOf(rhs interface{}) (desc string, f predicate.PredicateFunc)
IsSupersetOf tests if the value under test is a superset of the reference value. Both values must be containers and are treated as unordered sets.
func IsTrue ¶
func IsTrue() (desc string, f predicate.PredicateFunc)
IsTrue tests if a value is true
func Le ¶
func Le(rhs interface{}) (desc string, f predicate.PredicateFunc)
Le tests if a value is less than or equal to a reference value
func Length ¶
func Length() (desc string, f predicate.TransformFunc)
Length is a transformation predicate that extract the length of a value for further evaluation. It applies to values of type String, Array, Slice, Map, and Channel.
func Lt ¶
func Lt(rhs interface{}) (desc string, f predicate.PredicateFunc)
Lt tests if a value is strictly less than a reference value
func MapKeys ¶
func MapKeys() (desc string, f predicate.TransformFunc)
MapKeys is a transformation predicate that applies only to map values and extract its keys into an sequence for further evaluation. Note that the keys Will appear in no particular order.
func MapValues ¶
func MapValues() (desc string, f predicate.TransformFunc)
MapValues is a transformation predicate that applies only to map values and extract its values into an sequence for further evaluation. Note that the values Will appear in no particular order.
func Matches ¶
func Matches(re string) (desc string, f predicate.PredicateFunc)
Matches tests if a string matches a regular expression
func Ne ¶
func Ne(rhs interface{}) (desc string, f predicate.PredicateFunc)
Ne tests if a value is equatable but different from the specified value.
func Panics ¶
func Panics() (desc string, f predicate.PredicateFunc)
Panics verifies that the value under test is a callable function that panics. Special case using panic(nil) is considered an error because common recover() code will not catch it.
func PanicsAndRecoveredValue ¶
func PanicsAndRecoveredValue() (desc string, f predicate.TransformFunc)
PanicsAndRecoveredValue verifies that the value under test is a callable function that panics, and captures the recovered value for further evalation.
func Passes ¶
func Passes(p *predicate.Predicate) (desc string, f predicate.PredicateFunc)
Passes evaluates a sub-expression predicate against the value.
func StartsWith ¶
func StartsWith(rhs interface{}) (desc string, f predicate.PredicateFunc)
StartsWith tests if a sequence value starts with the given sequence, and can be applied to strings, arrays and slices.
func ToLower ¶
func ToLower() (desc string, f predicate.TransformFunc)
ToLower is a transformation predicate that converts any value to a string representation using `%v` formatting option.
func ToString ¶
func ToString() (desc string, f predicate.TransformFunc)
ToString is a transformation predicate that converts any value to a string representation using `%v` formatting option.
func ToUpper ¶
func ToUpper() (desc string, f predicate.TransformFunc)
ToUpper is a transformation predicate that converts any value to a string representation using `%v` formatting option.
Types ¶
This section is empty.