execute

open suspend override fun execute(query: String, arguments: Map<String, Any?>?): DittoQueryResult

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

NOTE: This method 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.

Return

A DittoQueryResult containing a DittoQueryResultItem for each match.

Since

4.11.0

Parameters

query

A string containing a valid query expressed in DQL.

arguments

A map of values keyed by the placeholder name without the leading :. Example: mapOf("mileage" to 123). Defaults to an empty map.

Throws

if the query string is not valid DQL.

if the arguments map is not valid (e.g., contains unsupported types).

If a mutating query is executed on a read-only transaction.

may also be thrown for other issues.