DittoQueryExecuting
public protocol DittoQueryExecuting
Defines the interface for executing DQL queries. Implemented by DittoStore
and DittoTransaction.
-
execute(query:Asynchronousarguments: ) Executes a DQL query and returns matching items as a query result.
NOTE: only returns results from the local store without waiting for any
DittoSyncSubscriptionto have caught up with the latest changes. Only use this method if your program must proceed with immediate results. Use aDittoStoreObserverto receive updates to query results as soon as they have been synced to this peer.Throws
DittoSwiftError>.storeError(.queryInvalid)ifquerystring is not valid DQL.Throws
DittoSwiftError>.storeError(.queryArgumentsInvalid)ifargumentsdictionary is not valid (contains unsupported types).Throws
DittoSwiftError>.storeError(.transactionReadOnly)this is thrown if called on a transaction that is read-only but a mutating query was executed.Throws
May throw other
DittoSwiftErrors.Declaration
Swift
@discardableResult func execute(query: String, arguments: Dictionary<String, Any?>) async throws -> DittoQueryResultReturn Value
A
DittoQueryResultcontaining aDittoQueryResultItemfor each match. -
execute(query:Extension method, asynchronous) Convenience method, same as
execute(query:arguments:)whereargumentsis an empty dictionary.Declaration
Swift
@discardableResult public func execute(query: String) async throws -> DittoQueryResult