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
applicationThe application this query belong to, default is
LCApplication.default.classNameThe 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
keyThe key will be constrained.
constraintSee
Constraint. -
Add a constraint for key.
Throws
LCErrorDeclaration
Swift
public func `where`(_ key: String, _ constraint: Constraint) throwsParameters
keyThe key will be constrained.
constraintSee
Constraint. -
Performs a logical AND operation on an array of one or more expressions of query.
Throws
LCErrorDeclaration
Swift
public class func and(_ queries: [LCQuery]) throws -> LCQueryParameters
queriesAn array of one or more expressions of query.
Return Value
A new
LCQuery. -
Performs a logical AND operation on self and the query.
Throws
LCErrorDeclaration
Swift
public func and(_ query: LCQuery) throws -> LCQueryParameters
queryThe query.
Return Value
A new
LCQuery. -
Performs a logical OR operation on an array of one or more expressions of query.
Throws
LCErrorDeclaration
Swift
public class func or(_ queries: [LCQuery]) throws -> LCQueryParameters
queriesAn array of one or more expressions of query.
Return Value
A new
LCQuery. -
Performs a logical OR operation on self and the query.
Throws
LCErrorDeclaration
Swift
public func or(_ query: LCQuery) throws -> LCQueryParameters
queryThe 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 : LCObjectParameters
cachePolicySee
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) -> LCRequestParameters
cachePolicySee
CachePolicy, default isCachePolicy.onlyNetwork.completionQueueThe queue where the
completionbe called, default isDispatchQueue.main.completionThe result callback of query.
Return Value
-
Get first object synchronously.
Declaration
Swift
public func getFirst<T>(cachePolicy: CachePolicy = .onlyNetwork) -> LCValueResult<T> where T : LCObjectParameters
cachePolicySee
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) -> LCRequestParameters
cachePolicySee
CachePolicy, default isCachePolicy.onlyNetwork.completionQueueThe queue where the
completionbe called, default isDispatchQueue.main.completionThe 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
objectIdThe ID of the object.
cachePolicySee
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) -> LCRequestParameters
objectIdThe ID of the object.
cachePolicySee
CachePolicy, default isCachePolicy.onlyNetwork.completionQueueThe queue where the
completionbe called, default isDispatchQueue.main.completionThe result callback of query.
Return Value
-
Count objects synchronously.
Declaration
Swift
public func count(cachePolicy: CachePolicy = .onlyNetwork) -> LCCountResultParameters
cachePolicySee
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) -> LCRequestParameters
cachePolicySee
CachePolicy, default isCachePolicy.onlyNetwork.completionQueueThe queue where the
completionbe called, default isDispatchQueue.main.completionThe result callback of query.
Return Value
View on GitHub
Install in Dash
LCQuery Class Reference