TransactionAsync

Struct TransactionAsync 

Source
pub struct TransactionAsync<'c> { /* private fields */ }
Expand description

Database transaction.

Begin a transaction using the BackendConnection transaction method.

Implementations§

Source§

impl<'c> TransactionAsync<'c>

Source

pub async fn commit(self) -> Result<(), Error>

Commit the transaction.

Source

pub async fn rollback(self) -> Result<(), Error>

Roll back the transaction. Equivalent to dropping it.

Trait Implementations§

Source§

impl ConnectionMethodsAsync for TransactionAsync<'_>

Source§

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn query<'c, 'life0, 'life1, 'life2, 'async_trait>( &'c self, table: &'life0 str, columns: &'life1 [Column], expr: Option<BoolExpr>, limit: Option<i32>, offset: Option<i32>, sort: Option<&'life2 [Order]>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn BackendRows + 'c>, Error>> + Send + 'async_trait>>
where 'c: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn insert_returning_pk<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<SqlVal, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn insert_only<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], values: &'life3 [SqlValRef<'life4>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, TransactionAsync<'_>: 'async_trait,

Like insert_returning_pk but with no return value.
Source§

fn insert_or_replace<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, columns: &'life2 [Column], pkcol: &'life3 Column, values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, TransactionAsync<'_>: 'async_trait,

Insert unless there’s a conflict on the primary key column, in which case update.
Source§

fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: Column, pk: SqlValRef<'life2>, columns: &'life3 [Column], values: &'life4 [SqlValRef<'life5>], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, pkcol: &'static str, pk: SqlVal, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn delete_where<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, expr: BoolExpr, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TransactionAsync<'_>: 'async_trait,

Source§

fn has_table<'life0, 'life1, 'async_trait>( &'life0 self, table: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TransactionAsync<'_>: 'async_trait,

Tests if a table exists in the database.
Source§

impl<'c> Debug for TransactionAsync<'c>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'c> Freeze for TransactionAsync<'c>

§

impl<'c> !RefUnwindSafe for TransactionAsync<'c>

§

impl<'c> Send for TransactionAsync<'c>

§

impl<'c> Sync for TransactionAsync<'c>

§

impl<'c> Unpin for TransactionAsync<'c>

§

impl<'c> !UnwindSafe for TransactionAsync<'c>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,