ObjectFilter

public class ObjectFilter : Codable

Defines criteria for filtering and ordering a result set of Coaty objects. Used in combination with Query events and database operations, as well as the ObjectMatcher functionality.

Attributes.

  • A set of conditions for filtering objects (optional).

    Declaration

    Swift

    public var conditions: ObjectFilterConditions?
  • A single condition for filtering objects (optional).

    Declaration

    Swift

    public var condition: ObjectFilterCondition?
  • Determines the ordering of result objects by an array of OrderByProperty objects.

    Declaration

    Swift

    public var orderByProperties: [OrderByProperty]?
  • If a take count is given, no more than that many objects will be returned (but possibly less, if the request itself yields less objects). Typically, this option is only useful if the orderByProperties option is also specified to ensure consistent ordering of paginated results.

    Declaration

    Swift

    public var take: Int?
  • If skip count is given that many objects are skipped before beginning to return result objects. Typically, this option is only useful if the orderByProperties option is also specified to ensure consistent ordering of paginated results.

    Declaration

    Swift

    public var skip: Int?

Initializers.

  • Create an instance of ObjectFilter based on a single condition.

    Declaration

    Swift

    public convenience init(condition: ObjectFilterCondition,
    
                            orderByProperties: [OrderByProperty]? = nil,
    
                            take: Int? = nil,
    
                            skip: Int? = nil)

    Parameters

    condition

    A single condition for filtering objects.

    orderByProperties

    Determines the ordering of result objects.

    take

    take at most the given count of hits

    skip

    skip the given count of hits

  • Create an instance of ObjectFilter based on a set of conditions.

    Declaration

    Swift

    public convenience init(conditions: ObjectFilterConditions,
    
                            orderByProperties: [OrderByProperty]? = nil,
    
                            take: Int? = nil,
    
                            skip: Int? = nil)

    Parameters

    condition

    A single condition for filtering objects.

    orderByProperties

    Determines the ordering of result objects.

    take

    take at most the given count of hits

    skip

    skip the given count of hits

Codable methods.

  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public required init(from decoder: Decoder) throws

Builder methods.

  • Builds a new ObjectFilter using the convenience closure syntax. This method can only be used to build objects that have exactly one condition.

    Declaration

    Swift

    public static func buildWithCondition(_ closure: (ObjectFilterBuilder) throws -> ()) throws -> ObjectFilter

    Parameters

    closure

    the builder closure, preferably used as trailing closure.

    Return Value

    ObjectFilter configured using the builder.

  • Builds a new ObjectFilter using the convenience closure syntax. This method can only be used to build objects that have multiple conditions.

    Declaration

    Swift

    public static func buildWithConditions(_ closure: (ObjectFilterBuilder) throws -> ()) throws -> ObjectFilter

    Parameters

    closure

    the builder closure, preferably used as trailing closure.

    Return Value

    ObjectFilter configured using the builder.