LCQuery
public class LCQuery : NSObject, NSCopying, NSCoding
Query
-
The application this query belong to.
Declaration
Swift
public let application: LCApplication
-
The class name of the object.
Declaration
Swift
public let objectClassName: String
-
The limit on the number of objects to return.
Declaration
Swift
public var limit: Int?
-
The number of objects to skip before returning.
Declaration
Swift
public var skip: Int?
-
The query result whether include ACL.
Declaration
Swift
public var includeACL: Bool?
-
If this property is a non-nil value, query will always use it as where condition, default is
nil
.Declaration
Swift
public var whereString: String?
-
The ordered keys.
Declaration
Swift
public var orderedKeys: String?
-
The included keys.
Declaration
Swift
public var includedKeys: Set<String>
-
The selected keys.
Declaration
Swift
public var selectedKeys: Set<String>
-
Initialization.
Declaration
Swift
public init( application: LCApplication = .default, className: String)
Parameters
application
The application this query belong to, default is
LCApplication.default
.className
The name of the class which will be queried.
-
Undocumented
Declaration
Swift
public func copy(with zone: NSZone?) -> Any
-
Undocumented
Declaration
Swift
public required init?(coder aDecoder: NSCoder)
-
Undocumented
Declaration
Swift
public func encode(with aCoder: NSCoder)
-
Constraint for key.
See moreDeclaration
Swift
public enum Constraint
-
Add a constraint for key.
Declaration
Swift
public func whereKey(_ key: String, _ constraint: Constraint)
Parameters
key
The key will be constrained.
constraint
See
Constraint
. -
Add a constraint for key.
Throws
LCError
Declaration
Swift
public func `where`(_ key: String, _ constraint: Constraint) throws
Parameters
key
The key will be constrained.
constraint
See
Constraint
. -
Performs a logical AND operation on an array of one or more expressions of query.
Throws
LCError
Declaration
Swift
public class func and(_ queries: [LCQuery]) throws -> LCQuery
Parameters
queries
An array of one or more expressions of query.
Return Value
A new
LCQuery
. -
Performs a logical AND operation on self and the query.
Throws
LCError
Declaration
Swift
public func and(_ query: LCQuery) throws -> LCQuery
Parameters
query
The query.
Return Value
A new
LCQuery
. -
Performs a logical OR operation on an array of one or more expressions of query.
Throws
LCError
Declaration
Swift
public class func or(_ queries: [LCQuery]) throws -> LCQuery
Parameters
queries
An array of one or more expressions of query.
Return Value
A new
LCQuery
. -
Performs a logical OR operation on self and the query.
Throws
LCError
Declaration
Swift
public func or(_ query: LCQuery) throws -> LCQuery
Parameters
query
The query.
Return Value
A new
LCQuery
. -
The constants used to specify interaction with the cached responses.
See moreDeclaration
Swift
public enum CachePolicy
-
Query objects synchronously.
Declaration
Swift
public func find<T>(cachePolicy: CachePolicy = .onlyNetwork) -> LCQueryResult<T> where T : LCObject
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.Return Value
The result of query.
-
Query objects asynchronously.
Declaration
Swift
@discardableResult public func find<T: LCObject>( cachePolicy: CachePolicy = .onlyNetwork, completionQueue: DispatchQueue = .main, completion: @escaping (LCQueryResult<T>) -> Void) -> LCRequest
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.completionQueue
The queue where the
completion
be called, default isDispatchQueue.main
.completion
The result callback of query.
Return Value
-
Get first object synchronously.
Declaration
Swift
public func getFirst<T>(cachePolicy: CachePolicy = .onlyNetwork) -> LCValueResult<T> where T : LCObject
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.Return Value
The result of query.
-
Get first object asynchronously.
Declaration
Swift
@discardableResult public func getFirst<T: LCObject>( cachePolicy: CachePolicy = .onlyNetwork, completionQueue: DispatchQueue = .main, completion: @escaping (LCValueResult<T>) -> Void) -> LCRequest
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.completionQueue
The queue where the
completion
be called, default isDispatchQueue.main
.completion
The result callback of query.
Return Value
-
Get object by ID synchronously.
Declaration
Swift
public func get<T: LCObject>( _ objectId: LCStringConvertible, cachePolicy: CachePolicy = .onlyNetwork) -> LCValueResult<T>
Parameters
objectId
The ID of the object.
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.Return Value
The result of query.
-
Get object by ID asynchronously.
Declaration
Swift
@discardableResult public func get<T: LCObject>( _ objectId: LCStringConvertible, cachePolicy: CachePolicy = .onlyNetwork, completionQueue: DispatchQueue = .main, completion: @escaping (LCValueResult<T>) -> Void) -> LCRequest
Parameters
objectId
The ID of the object.
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.completionQueue
The queue where the
completion
be called, default isDispatchQueue.main
.completion
The result callback of query.
Return Value
-
Count objects synchronously.
Declaration
Swift
public func count(cachePolicy: CachePolicy = .onlyNetwork) -> LCCountResult
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.Return Value
The result of query.
-
Count objects asynchronously.
Declaration
Swift
@discardableResult public func count( cachePolicy: CachePolicy = .onlyNetwork, completionQueue: DispatchQueue = .main, completion: @escaping (LCCountResult) -> Void) -> LCRequest
Parameters
cachePolicy
See
CachePolicy
, default isCachePolicy.onlyNetwork
.completionQueue
The queue where the
completion
be called, default isDispatchQueue.main
.completion
The result callback of query.
Return Value