DittoQueryExecuting

public protocol DittoQueryExecuting

Defines the interface for executing DQL queries. Implemented by DittoStore and DittoTransaction.

  • Executes a DQL query and returns matching items as a query result.

    NOTE: only returns results from the local store without waiting for any DittoSyncSubscription to have caught up with the latest changes. Only use this method if your program must proceed with immediate results. Use a DittoStoreObserver to receive updates to query results as soon as they have been synced to this peer.

    Throws

    DittoSwiftError > .storeError(.queryInvalid) if query string is not valid DQL.

    Throws

    DittoSwiftError > .storeError(.queryArgumentsInvalid) if arguments dictionary 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 -> DittoQueryResult

    Return Value

    A DittoQueryResult containing a DittoQueryResultItem for each match.

  • execute(query:) Extension method, asynchronous

    Convenience method, same as execute(query:arguments:) where arguments is an empty dictionary.

    Declaration

    Swift

    @discardableResult
    public func execute(query: String) async throws -> DittoQueryResult