Represents a transaction in the Ditto store. More...
Public Member Functions | |
| ~Transaction () | |
| Destructor. | |
| Transaction (const Transaction &)=delete | |
| Transaction & | operator= (const Transaction &)=delete |
| Transaction (Transaction &&)=default | |
| Transaction & | operator= (Transaction &&)=default |
| TransactionInfo | get_info () const |
| Provides information about the transaction. | |
| Store & | get_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. | |
Represents a transaction in the Ditto store.
A Transaction is used to group multiple operations into a single atomic unit. This ensures that either all operations within the transaction are applied, or none of them are, maintaining the integrity of the data.
Please consult the documentation of Store::transaction for more information on how to create and use transactions. For a complete guide on transactions, please refer to the Ditto documentation.
| QueryResult ditto::Transaction::execute | ( | std::string | query, |
| nlohmann::json | query_args = nullptr ) |
Executes a DQL query and returns matching items as a query result.
| query | a string containing a valid query expressed in DQL. |
| query_args | a dictionary of values keyed by the placeholder name without the leading :. Example: {{"mileage", 123}}. |
| `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. |