Struct qldb::Transaction
source · [−]pub struct Transaction { /* private fields */ }Expand description
Every query in QLDB is within a transaction. Ideally you will interact with this object via the method QLDBClient::transaction_within.
Implementations
sourceimpl Transaction
impl Transaction
sourcepub fn query(&self, statement: &str) -> QueryBuilder
pub fn query(&self, statement: &str) -> QueryBuilder
Sends a query to QLDB. It will return an Array of IonValues already decoded. Parameters need to be provided using IonValue.
pub async fn commit(&self) -> QldbResult<()>
sourcepub async fn rollback(&self) -> QldbResult<()>
pub async fn rollback(&self) -> QldbResult<()>
Cancels the transaction. Once rollback is called the transaction becomes invalid. Subsequent calls to rollback or commit (internally) won’t have any effect.
It fails is the transaction is already committed. For
a rollback that doesn’t fail when already committed you can
check the silent_rollback method.
sourcepub async fn silent_rollback(&self) -> QldbResult<()>
pub async fn silent_rollback(&self) -> QldbResult<()>
Cancels the transaction but it doesn’t fails is the transaction was already committed. This is useful for auto-closing scenarios where you just want to rollback always when there is a drop or something similar.
Once rollback is called the transaction becomes invalid. Subsequent calls to rollback or commit (internally) won’t have any effect.
Trait Implementations
sourceimpl Clone for Transaction
impl Clone for Transaction
sourcefn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl !UnwindSafe for Transaction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more