Filter
public class Filter
A Filter that can be used for queries.
Example:
Devices activated in the last hour that implement a com:acme:device
device model.
The following code:
f = Filter.and(
Filter.gte(Device.Field.CREATED.alias(),
(System.currentTimeMillis() - 3600000L)),
Filter.eq(Device.Field.STATE.alias(), "ACTIVATED"),
Filter.like(Device.Field.DEVICE_MODELS.alias() + ".urn",
"urn:com:acme:device:%"));
will create the following Json object:
{"$and":[
{"created":{"$gte":1457137772894}},
{"state":{"$eq":"ACTIVATED"}},
{"deviceModels.urn":{"$like":"urn:com:acme:device:%"}}]}
-
Creates a query filter that performs the logical AND between sub filters provided as argument:
(filter1 and filter2 and ...).Declaration
Swift
public static func and(filters: [Filter]) -> FilterParameters
filtersSub filters to combine.
Return Value
A new filter
{ "$and": [ filter1, filter2, .... ] }. -
Creates a query filter that performs the logical OR between sub filters provided as argument:
(filter1 or filter2 or ...).Declaration
Swift
public static func or(filters: [Filter]) -> FilterParameters
filtersSub filters to combine.
Return Value
A new filter
{ "$or": [ filter1, filter2, .... ] }. -
Creates a query filter that performs the logical NOT on the filter provided as argument:
(not filter).Declaration
Swift
public static func not(filter: Filter) -> FilterParameters
filterfilter on which to apply the NOT.
Return Value
A new filter
{ "$not": filter }. -
Creates a query filter that performs
(op1 == op2).Declaration
Swift
public static func eq(op1: String, op2: String) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$eq": op2 } }. -
Creates a query filter that performs
(op1 == op2).Declaration
Swift
public static func eq(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$eq": op2 } }. -
Creates a query filter that performs
(op1 == op2).Declaration
Swift
public static func eq(op1: String, op2: Bool) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$eq": op2 } }. -
Creates a query filter that performs
(op1 == op2).Declaration
Swift
public static func eq(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$eq": op2 } }. -
Creates a query filter that checks if
op1exists.Declaration
Swift
public static func exists(op1: String, e: Bool) -> FilterParameters
op1First operand.
eEither
trueto check that exists, orfalseto check that not exists.Return Value
A new filter performing
{ op1: { "$exists" : true/false }}. -
Creates a query filter that checks if the value matches the pattern.
Declaration
Swift
public static func like(value: String, pattern: String) -> FilterParameters
valueThe value to check.
patternThe pattern to match.
Return Value
A new filter performing
{ op1: { "$like" : pattern }}. -
Creates a query filter that performs
(key IN [value1, value2, ...]).Declaration
Swift
public static func _in(key: String, values: [String]) -> FilterParameters
keyThe key to check.
valuesThe list of values to compare with.
Return Value
A new filter
{ key: { "$in" : [value1, value2, ...] }}. -
Creates a query filter that performs
(key IN [value1, value2, ...]).Declaration
Swift
public static func _in(key: String, values: [CLongLong]) -> FilterParameters
keyThe key to check.
valuesThe list of values to compare with.
Return Value
A new filter
{ key: { "$in" : [value1, value2, ...] }}. -
Creates a query filter that performs
(key IN [value1, value2, ...])Declaration
Swift
public static func _in(key: String, values: [Double]) -> FilterParameters
keyThe key to check.
valuesThe list of values to compare with.
Return Value
A new filter
{ key: { "$in" : [value1, value2, ...] }}. -
Creates a query filter that performs
(key IN [value1, value2, ...]).Declaration
Swift
public static func _in(key: String, values: [Bool]) -> FilterParameters
keyThe key to check.
valuesThe list of values to compare with.
Return Value
A new filter
{ key: { "$in" : [value1, value2, ...] }}. -
Creates a query filter that performs
(op1 != op2).Declaration
Swift
public static func ne(op1: String, op2: String) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$ne": op2 } }. -
Creates a query filter that performs
(op1 != op2).Declaration
Swift
public static func ne(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$ne": op2 } }. -
Creates a query filter that performs
(op1 != op2).Declaration
Swift
public static func ne(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$ne": op2 } }. -
Creates a query filter that performs
(op1 != op2).Declaration
Swift
public static func ne(op1: String, op2: Bool) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$ne": op2 } }. -
Creates a query filter that performs
(op1 <= op2).Declaration
Swift
public static func lte(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$lte": op2 } }. -
Creates a query filter that performs
(op1 <= op2).Declaration
Swift
public static func lte(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$lte": op2 } }. -
Creates a query filter that performs
(op1 >= op2).Declaration
Swift
public static func gte(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$gte": op2 } }. -
Creates a query filter that performs
(op1 >= op2).Declaration
Swift
public static func gte(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$gte": op2 } }. -
Creates a query filter that performs
(op1 < op2).Declaration
Swift
public static func lt(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$lt": op2 } }. -
Creates a query filter that performs
(op1 < op2).Declaration
Swift
public static func lt(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$lt": op2 } }. -
Creates a query filter that performs
(op1 > op2).Declaration
Swift
public static func gt(op1: String, op2: CLongLong) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$gt": op2 } }. -
Creates a query filter that performs
(op1 > op2).Declaration
Swift
public static func gt(op1: String, op2: Double) -> FilterParameters
op1First operand.
op2Second operand.
Return Value
A new filter
{ op1: { "$gt": op2 } }.
Filter Class Reference