pub struct Transaction { /* private fields */ }Expand description
An active Ignite transaction.
Drop without committing will roll back the transaction (best-effort, fire-and-forget).
Call .commit() to commit or .rollback() for explicit rollback.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn cache(&self, name: &str) -> IgniteCache
pub fn cache(&self, name: &str) -> IgniteCache
Return a IgniteCache handle that participates in this transaction.
Every cache operation on the returned handle embeds the transaction’s
tx_id in the request flags, so reads and writes are part of the
current transaction and subject to its commit/rollback.
Sourcepub async fn query(
&mut self,
sql: &str,
params: Vec<IgniteValue>,
) -> Result<QueryResult>
pub async fn query( &mut self, sql: &str, params: Vec<IgniteValue>, ) -> Result<QueryResult>
Execute a SELECT inside this transaction. All rows fetched eagerly.
Sourcepub async fn query_stream(
&mut self,
sql: &str,
params: Vec<IgniteValue>,
) -> Result<QueryStream>
pub async fn query_stream( &mut self, sql: &str, params: Vec<IgniteValue>, ) -> Result<QueryStream>
Execute a SELECT inside this transaction and return rows lazily as a QueryStream.
The first page is fetched immediately; subsequent pages are fetched on demand as the stream is polled. The stream shares the transaction’s dedicated connection, so concurrent queries on the same transaction are multiplexed safely.
Sourcepub async fn execute(
&mut self,
sql: &str,
params: Vec<IgniteValue>,
) -> Result<UpdateResult>
pub async fn execute( &mut self, sql: &str, params: Vec<IgniteValue>, ) -> Result<UpdateResult>
Execute a DML statement (INSERT/UPDATE/DELETE) inside this transaction.