pub struct Transaction { /* private fields */ }Expand description
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 ditto.store().transaction() or the
module-level docs for more information on how to create and use transactions. For a
complete guide on transactions, please refer to the Ditto documentation
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn info(&self) -> TransactionInfo
pub fn info(&self) -> TransactionInfo
Information about the current transaction.
Sourcepub async fn execute<Q>(&self, query: Q) -> Result<QueryResult, DittoError>
pub async fn execute<Q>(&self, query: Q) -> Result<QueryResult, DittoError>
Executes a DQL query and returns matching items as a QueryResult.
Note that this method only returns results from the local store without waiting for any
SyncSubscriptions to have caught up with the latest
changes. Only use this method if your program must proceed with immediate results. Use a
StoreObserver (obtained from
ditto.store().register_observer()) to receive
updates to query results as soon as they have been synced to this peer.