Filter
public class Filter: DictionaryLiteralConvertible
An instance of the Filter class is used to filter query results All filters are automatically converted into SQLite statements when querying the database.
To make filtering easier, and backwards compatibility, it is possible to instantiate a filter object as a dictionary literal
Example:
Return any objects with the name ‘Ghost’
let filter: Filter = ["name": "Ghost"]
let filter = Filter.equal("name", value: "Ghost")
-
Initialize a Filter object using a dictionary. All property-value pairs will limit the results to objects where property’s value is equal to the provided value
Declaration
Swift
public required init(dictionaryLiteral elements: (Key, Value)...) -
Initialize a new, empty Filter object
Declaration
Swift
public init() {}
-
Evaluated as true if the value of the property is equal to the provided value
Declaration
Swift
public func equal(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property is less than the provided value
Declaration
Swift
public func lessThan(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property is greater than the provided value
Declaration
Swift
public func greaterThan(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property is not equal to the provided value
Declaration
Swift
public func notEqual(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property is contained in the array
Declaration
Swift
public func contains(propertyName: String, array: [SQLiteValue?]) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property is not contained in the array
Declaration
Swift
public func notContains(propertyName: String, array: [SQLiteValue?]) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should not contain the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property matches the pattern.
% matches any string
_ matches a single character
‘Dog’ LIKE ’D_g’ = true
‘Dog’ LIKE ’D%’ = true
Declaration
Swift
public func like(propertyName: String, pattern: String) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
self, to enable chaining of statements -
Evaluated as true if the value of the property matches the pattern.
% matches any string
_ matches a single character
‘Dog’ NOT LIKE ’D_g’ = false
‘Dog’ NOT LIKE ’D%’ = false
Declaration
Swift
public func notLike(propertyName: String, pattern: String) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
Filterintance
-
Evaluated as true if the value of the property is equal to the provided value
Declaration
Swift
public class func equal(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
Filterintance -
Evaluated as true if the value of the property is less than the provided value
Declaration
Swift
public class func lessThan(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
Filterintance -
Evaluated as true if the value of the property is greater than the provided value
Declaration
Swift
public class func greaterThan(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
Filterintance -
Evaluated as true if the value of the property is not equal to the provided value
Declaration
Swift
public class func notEqual(propertyName: String, value: SQLiteValue?) -> FilterParameters
propertyNamename of the property to be evaluated
arrayvalue that will be compared to the property value
Return Value
Filterintance -
Evaluated as true if the value of the property is contained in the array
Declaration
Swift
public class func contains(propertyName: String, array: [SQLiteValue?]) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
Filterintance -
Evaluated as true if the value of the property is not contained in the array
Declaration
Swift
public class func notContains(propertyName: String, array: [SQLiteValue?]) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should not contain the property value
Return Value
Filterintance -
Evaluated as true if the value of the property matches the pattern.
% matches any string
_ matches a single character
‘Dog’ LIKE ’D_g’ = true
‘Dog’ LIKE ’D%’ = true
Declaration
Swift
public class func like(propertyName: String, pattern: String) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
Filterintance -
Evaluated as true if the value of the property matches the pattern.
% matches any string
_ matches a single character
‘Dog’ NOT LIKE ’D_g’ = false
‘Dog’ NOT LIKE ’D%’ = false
Declaration
Swift
public class func notLike(propertyName: String, pattern: String) -> FilterParameters
propertyNamename of the property to be evaluated
arrayarray that should contain the property value
Return Value
Filterintance
-
Generates a list of tuples containing statements and values from the filter components
Declaration
Swift
public func generate() -> IndexingGenerator<[(String, Any?)]>
Filter Class Reference