Struct luna_orm::prelude::Transaction
source · pub struct Transaction<'a, G>where
G: SqlGenerator + Sync,{ /* private fields */ }Implementations§
source§impl<'a, G> Transaction<'a, G>where
G: SqlGenerator + Sync,
impl<'a, G> Transaction<'a, G>where
G: SqlGenerator + Sync,
pub fn new(trx: Transaction<'a, Any>, sql_generator: &'a G) -> Self
pub async fn commit(self) -> Result<(), LunaOrmError>
pub async fn rollback(self) -> Result<(), LunaOrmError>
pub async fn query(&mut self, sql: &str) -> Result<usize, LunaOrmError>
pub async fn remove<SE>( &mut self, primary: &dyn Primary, selection: &dyn Selection ) -> LunaOrmResult<Option<SE>>
Trait Implementations§
source§impl<'a, G> CommandExecutor for Transaction<'a, G>where
G: SqlGenerator + Sync,
impl<'a, G> CommandExecutor for Transaction<'a, G>where
G: SqlGenerator + Sync,
type G = G
fn get_generator(&self) -> &Self::G
fn select<'life0, 'life1, 'life2, 'async_trait, SE>(
&'life0 mut self,
primary: &'life1 dyn Primary,
selection: &'life2 dyn Selection
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Option<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create<'a, 'life0, 'async_trait>(
&'life0 mut self,
entity: &'a dyn Entity
) -> Pin<Box<dyn Future<Output = LunaOrmResult<&'a dyn Entity>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'life1, 'async_trait>(
&'life0 mut self,
entity: &'life1 dyn Entity
) -> Pin<Box<dyn Future<Output = LunaOrmResult<bool>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn upsert<'life0, 'life1, 'async_trait>(
&'life0 mut self,
entity: &'life1 dyn Entity
) -> Pin<Box<dyn Future<Output = LunaOrmResult<bool>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
mutation: &'life1 dyn Mutation,
primary: &'life2 dyn Primary
) -> Pin<Box<dyn Future<Output = LunaOrmResult<bool>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
primary: &'life1 dyn Primary
) -> Pin<Box<dyn Future<Output = LunaOrmResult<bool>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'life2, 'life3, 'async_trait, SE>(
&'life0 mut self,
location: &'life1 dyn Location,
order_by: Option<&'life2 dyn OrderBy>,
selection: &'life3 dyn Selection
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Vec<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
location: &'life1 dyn Location
) -> Pin<Box<dyn Future<Output = LunaOrmResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_paged<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, SE>(
&'life0 mut self,
location: &'life1 dyn Location,
order_by: Option<&'life2 dyn OrderBy>,
selection: &'life3 dyn Selection,
page: &'life4 Pagination
) -> Pin<Box<dyn Future<Output = LunaOrmResult<PagedList<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn search_joined<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait, SE>(
&'life0 mut self,
joined_conds: JoinedConditions,
locations: Vec<&'life1 dyn Location>,
order_by: Option<&'life2 dyn OrderBy>,
selections: Vec<&'life3 dyn Selection>,
page: &'life4 Pagination
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
SE: 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn purify<'life0, 'life1, 'async_trait>(
&'life0 mut self,
location: &'life1 dyn Location
) -> Pin<Box<dyn Future<Output = LunaOrmResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn change<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
mutation: &'life1 dyn Mutation,
location: &'life2 dyn Location
) -> Pin<Box<dyn Future<Output = LunaOrmResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_by_template<'life0, 'life1, 'async_trait>(
&'life0 mut self,
template: &'life1 dyn TemplateRecord
) -> Pin<Box<dyn Future<Output = LunaOrmResult<usize>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn select_by_template<'life0, 'life1, 'async_trait, SE>(
&'life0 mut self,
template: &'life1 dyn TemplateRecord
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Option<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_by_template<'life0, 'life1, 'async_trait, SE>(
&'life0 mut self,
template: &'life1 dyn TemplateRecord
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Vec<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_paged_by_template<'life0, 'life1, 'life2, 'async_trait, SE>(
&'life0 mut self,
template: &'life1 dyn TemplateRecord,
page: &'life2 Pagination
) -> Pin<Box<dyn Future<Output = LunaOrmResult<PagedList<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
source§impl<'a, G> SqlExecutor for Transaction<'a, G>where
G: SqlGenerator + Sync,
impl<'a, G> SqlExecutor for Transaction<'a, G>where
G: SqlGenerator + Sync,
fn fetch_optional<'life0, 'life1, 'life2, 'async_trait, SE>(
&'life0 mut self,
stmt: &'life1 str,
args: AnyArguments<'life2>
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Option<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_all<'life0, 'life1, 'life2, 'async_trait, SE>(
&'life0 mut self,
stmt: &'life1 str,
args: AnyArguments<'life2>
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Vec<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
stmt: &'life1 str,
args: AnyArguments<'life2>
) -> Pin<Box<dyn Future<Output = LunaOrmResult<AnyQueryResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_plain<'life0, 'life1, 'async_trait>(
&'life0 mut self,
stmt: &'life1 str
) -> Pin<Box<dyn Future<Output = LunaOrmResult<AnyQueryResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_pool(&self) -> LunaOrmResult<&AnyPool>
fn fetch_optional_plain<'life0, 'life1, 'async_trait, SE>(
&'life0 mut self,
stmt: &'life1 str
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Option<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_all_plain<'life0, 'life1, 'async_trait, SE>(
&'life0 mut self,
stmt: &'life1 str
) -> Pin<Box<dyn Future<Output = LunaOrmResult<Vec<SE>>> + Send + 'async_trait>>where
SE: SelectedEntity + Send + Unpin + 'async_trait,
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl<'a, G> !RefUnwindSafe for Transaction<'a, G>
impl<'a, G> Send for Transaction<'a, G>
impl<'a, G> !Sync for Transaction<'a, G>
impl<'a, G> Unpin for Transaction<'a, G>
impl<'a, G> !UnwindSafe for Transaction<'a, G>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more