Ditto 4.11.1
 
Loading...
Searching...
No Matches
ditto::Transaction Class Reference

Classes

struct  Impl
 

Public Member Functions

 ~Transaction ()
 Destructor.
 
 Transaction (const Transaction &)=delete
 
Transactionoperator= (const Transaction &)=delete
 
TransactionInfo get_info () const
 Provides information about the transaction.
 
Storeget_store () const
 The Store this transaction belongs to.
 
QueryResult execute (std::string query, nlohmann::json query_args=nullptr)
 Executes a DQL query and returns matching items as a query result.
 

Member Function Documentation

◆ execute()

QueryResult ditto::Transaction::execute ( std::string query,
nlohmann::json query_args = nullptr )

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

Note
Only returns results from the local store without waiting for any SyncSubscription to have caught up with the latest changes. Only use this method if your program must proceed with immediate results. Use a Observer to receive updates to query results as soon as they have been synced to this peer.
Parameters
querya string containing a valid query expressed in DQL.
query_argsa dictionary of values keyed by the placeholder name without the leading :. Example: {{"mileage", 123}}.
Returns
a QueryResult object containing a QueryResultItem for each match.
Exceptions
`TransactionReadOnlyError`if the transaction is read-only but a mutating query was executed
`DittoError`if the query is not a valid DQL query or if the query fails.