Documentation ¶
Index ¶
- func And(predicates ...Predicate) *predAnd
- func Between(attribute string, from interface{}, to interface{}) *predBetween
- func Equal(attributeName string, value interface{}) *predEqual
- func False() *predFalse
- func Greater(attributeName string, value interface{}) *predGreaterLess
- func GreaterOrEqual(attributeName string, value interface{}) *predGreaterLess
- func ILike(attributeName string, pattern string) *predILike
- func In(attributeName string, values ...interface{}) *predIn
- func InstanceOf(className string) *predInstanceOf
- func Less(attributeName string, value interface{}) *predGreaterLess
- func LessOrEqual(attributeName string, value interface{}) *predGreaterLess
- func Like(attributeName string, expression string) *predLike
- func Not(predicate Predicate) *predNot
- func NotEqual(attributeName string, value interface{}) *predNotEqual
- func Or(predicates ...Predicate) *predOr
- func Regex(attributeName string, expression string) *predRegex
- func SQL(expression string) *predSQL
- func True() *predTrue
- type PagingPredicate
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
func And(predicates ...Predicate) *predAnd
And creates a predicate that will perform the logical and operation on the given predicates. If no predicate is provided as argument, the created predicate will always evaluate to true.
func Between ¶
func Between(attribute string, from interface{}, to interface{}) *predBetween
Between creates a predicate that will pass items if the value stored under the given item attribute is contained inside the given range.
The bounds are inclusive.
func Equal ¶
func Equal(attributeName string, value interface{}) *predEqual
Equal creates a predicate that will pass items if the given value and the value stored under the given item attribute are equal.
func False ¶
func False() *predFalse
False creates a predicate that always evaluates to false and passes no items.
func Greater ¶
func Greater(attributeName string, value interface{}) *predGreaterLess
Greater creates a predicate that will pass items if the value stored under the given item attribute is greater than the given value.
func GreaterOrEqual ¶
func GreaterOrEqual(attributeName string, value interface{}) *predGreaterLess
GreaterOrEqual creates a predicate that will pass items if the value stored under the given item attribute is greater than or equal to the given value.
func ILike ¶
ILike creates a predicate that will pass items if the given pattern matches the value stored under the given item attribute in a case-insensitive manner.
The % (percentage sign) is a placeholder for multiplecharacters, the _ (underscore) is a placeholder for a single character. If you need to match the percentage sign or the underscore character itself, escape it with the backslash, for example "\\%" string will match the percentage sign.
func In ¶
func In(attributeName string, values ...interface{}) *predIn
In creates a predicate that will pass items if the value stored under the given item attribute is a member of the given values.
func InstanceOf ¶
func InstanceOf(className string) *predInstanceOf
InstanceOf creates a predicate that will pass entries for which the value class is an instance of the given className.
func Less ¶
func Less(attributeName string, value interface{}) *predGreaterLess
Less creates a predicate that will pass items if the value stored under the given item “attribute“ is less than the given value.
func LessOrEqual ¶
func LessOrEqual(attributeName string, value interface{}) *predGreaterLess
LessOrEqual creates a predicate that will pass items if the value stored under the given item attribute is less than or equal to the given value.
func Like ¶
Like creates a predicate that will pass items if the given pattern matches the value stored under the given item attribute in a case-sensitive manner.
The % (percentage sign) is a placeholder for multiplecharacters, the _ (underscore) is a placeholder for a single character. If you need to match the percentage sign or the underscore character itself, escape it with the backslash, for example "\\%" string will match the percentage sign.
func Not ¶
func Not(predicate Predicate) *predNot
Not creates a predicate that will negate the result of the given predicate.
func NotEqual ¶
func NotEqual(attributeName string, value interface{}) *predNotEqual
NotEqual creates a predicate that will pass items if the given value and the value stored under the given item attribute are not equal.
func Or ¶
func Or(predicates ...Predicate) *predOr
Or creates a predicate that will perform the logical or operation on the given predicates.
func Regex ¶
Regex creates a predicate that will pass items if the given pattern matches the value stored under the given item attribute.
The pattern interpreted exactly the same as described in https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html.
func SQL ¶
func SQL(expression string) *predSQL
SQL creates a predicate that will pass items that match the given SQL where expression.
The following operators are supported: =, <, >, <=, >=, ==, !=, <>, BETWEEN, IN, LIKE, ILIKE, REGEX, AND, OR, NOT.
The operators are case-insensitive, but attribute names are case sensitive.
Example:
active AND (age > 20 OR salary < 60000)
Differences to standard SQL: * We don't use ternary boolean logic. field=10 evaluates to false, if field is null, in standard SQL it evaluates to UNKNOWN. * IS [NOT] NULL is not supported, use =NULL or <>NULL. * IS [NOT] DISTINCT FROM is not supported, but = and <> behave like it.
Types ¶
type PagingPredicate ¶
type Predicate ¶
type Predicate interface { serialization.IdentifiedDataSerializable fmt.Stringer }
Source Files ¶
- predicate.go
- predicate_and.go
- predicate_between.go
- predicate_equal.go
- predicate_false.go
- predicate_greater.go
- predicate_greater_less.go
- predicate_greater_or_equal.go
- predicate_ilike.go
- predicate_in.go
- predicate_instance_of.go
- predicate_less.go
- predicate_less_or_equal.go
- predicate_like.go
- predicate_not.go
- predicate_not_equal.go
- predicate_or.go
- predicate_regex.go
- predicate_sql.go
- predicate_true.go