FilterOperations

public class FilterOperations

Defines filter operator functions that yield object filter expressions.

  • Checks if the filter property is less than the given value. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func lessThan(value: Double) -> (ObjectFilterOperator, Double)
  • Checks if the filter property is less than the given value. For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func lessThan(value: String) -> (ObjectFilterOperator, String)
  • Checks if the filter property is less than or equal to the given value. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func lessThanOrEqual(value: Double) -> (ObjectFilterOperator, Double)
  • Checks if the filter property is less than or equal to the given value. For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func lessThanOrEqual(value: String) -> (ObjectFilterOperator, String)
  • Checks if the filter property is greater than the given value. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func greaterThan(value: Double) -> (ObjectFilterOperator, Double)
  • Checks if the filter property is greater than the given value. For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func greaterThan(value: String) -> (ObjectFilterOperator, String)
  • Checks if the filter property is greater than or equal to the given value. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func greaterThanOrEqual(value: Double) -> (ObjectFilterOperator, Double)
  • Checks if the filter property is greater than or equal to the given value. For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func greaterThanOrEqual(value: String) -> (ObjectFilterOperator, String)
  • Checks if the filter property is between the given values, i.e. prop >= value1 AND prop <= value2. If the first argument value1 is not less than or equal to the second argument value2, those two arguments are automatically swapped. Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func between(value1: Double, value2: Double) -> (ObjectFilterOperator, Double, Double)
  • Checks if the filter property is between the given values, i.e. prop >= value1 AND prop <= value2. If the first argument value1 is not less than or equal to the second argument value2, those two arguments are automatically swapped. For string comparison, a default lexical ordering is used. Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func between(value1: String, value2: String) -> (ObjectFilterOperator, String, String)
  • Checks if the filter property is not between the given values, i.e. prop < value1 OR prop > value2. If the first argument value1 is not less than or equal to the second argument value2, those two arguments are automatically swapped. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func notBetween(value1: Double, value2: Double) -> (ObjectFilterOperator, Double, Double)
  • Checks if the filter property is not between the given values, i.e. prop < value1 OR prop > value2. If the first argument value1 is not less than or equal to the second argument value2, those two arguments are automatically swapped. For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.

    Declaration

    Swift

    public static func notBetween(value1: String, value2: String) -> (ObjectFilterOperator, String, String)
  • Checks if the filter property string matches the given pattern. If pattern does not contain percent signs or underscores, then the pattern only represents the string itself; in that case LIKE acts like the equals operator (but less performant). An underscore (_) in pattern stands for (matches) any single character; a percent sign (%) matches any sequence of zero or more characters.

    LIKE pattern matching always covers the entire string. Therefore, if it’s desired to match a sequence anywhere within a string, the pattern must start and end with a percent sign.

    To match a literal underscore or percent sign without matching other characters, the respective character in pattern must be preceded by the escape character. The default escape character is the backslash. To match the escape character itself, write two escape characters.

    For example, the pattern string %a_c\\d\_ matches abc\d_ in hello abc\d_ and acc\d_ in acc\d_, but nothing in hello abc\d_world. Note that in programming languages like JavaScript, Java, or C#, where the backslash character is used as escape character for certain special characters you have to double backslashes in literal string constants. Thus, for the example above the pattern string literal would look like "%a_c\\\\d\\_".

    Declaration

    Swift

    public static func like(pattern: String) -> (ObjectFilterOperator, String)
  • Checks if the filter property exists.

    Declaration

    Swift

    public static func exists() -> (ObjectFilterOperator)
  • Checks if the filter property doesn’t exist.

    Declaration

    Swift

    public static func notExists() -> (ObjectFilterOperator)
  • Checks if the filter property is deep equal to the given value according to a recursive equality algorithm.

    Declaration

    Swift

    public static func equals(value: AnyCodable) -> (ObjectFilterOperator, AnyCodable)
  • Checks if the filter property is not deep equal to the given value according to a recursive equality algorithm.

    Declaration

    Swift

    public static func notEquals(value: AnyCodable) -> (ObjectFilterOperator, AnyCodable)
  • Checks if the filter property value (usually an object or array) contains the given values. Primitive value types (number, string, boolean, null) contain only the identical value. Object properties match if all the key-value pairs of the specified object are contained in them. Array properties match if all the specified array elements are contained in them.

    The general principle is that the contained object must match the containing object as to structure and data contents recursively on all levels, possibly after discarding some non-matching array elements or object key/value pairs from the containing object. But remember that the order of array elements is not significant when doing a containment match, and duplicate array elements are effectively considered only once.

    As a special exception to the general principle that the structures must match, an array on toplevel may contain a primitive value:

    contains([1, 2, 3], [3]) => true
    contains([1, 2, 3], 3) => true
    

    Declaration

    Swift

    public static func contains(values: AnyCodable) -> (ObjectFilterOperator, AnyCodable)
  • Checks if the filter property value (usually an object or array) does not contain the given values. Primitive value types (number, string, boolean, null) contain only the identical value. Object properties match if all the key-value pairs of the specified object are not contained in them. Array properties match if all the specified array elements are not contained in them.

    The general principle is that the contained object must match the containing object as to structure and data contents recursively on all levels, possibly after discarding some non-matching array elements or object key/value pairs from the containing object. But remember that the order of array elements is not significant when doing a containment match, and duplicate array elements are effectively considered only once.

    As a special exception to the general principle that the structures must match, an array on toplevel may contain a primitive value

    notContains([1, 2, 3], [4]) => true
    notContains([1, 2, 3], 4) => true
    

    Declaration

    Swift

    public static func notContains(values: AnyCodable) -> (ObjectFilterOperator, AnyCodable)
  • Checks if the filter property value is included on toplevel in the given operand array of values which may be primitive types (number, string, boolean, null) or object types compared using the deep equality operator.

    For example:

    in(47, [1, 46, 47, "foo"]) => true
    in(47, [1, 46, "47", "foo"]) => false
    in({ "foo": 47 }, [1, 46, { "foo": 47 }, "foo"]) => true
    in({ "foo": 47 }, [1, 46, { "foo": 47, "bar": 42 }, "foo"]) => false
    

    Declaration

    Swift

    public static func valuesIn(values: [AnyCodable]) -> (ObjectFilterOperator, [AnyCodable])
  • Checks if the filter property value is not included on toplevel in the given operand array of values which may be primitive types (number, string, boolean, null) or object types compared using the deep equality operator.

    For example:

    notIn(47, [1, 46, 47, "foo"]) => false
    notIn(47, [1, 46, "47", "foo"]) => true
    notIn({ "foo": 47 }, [1, 46, { "foo": 47 }, "foo"]) => false
    notIn({ "foo": 47 }, [1, 46, { "foo": 47, "bar": 42 }, "foo"]) => true
    

    Declaration

    Swift

    public static func valuesNotIn(values: [AnyCodable]) -> (ObjectFilterOperator, [AnyCodable])