pub struct TryInsert<A>where
A: ActiveModelTrait,{ /* private fields */ }
Expand description
Performs INSERT operations on a ActiveModel, will do nothing if input is empty.
All functions works the same as if it is Insert. Please refer to Insert page for more information
Implementationsยง
sourceยงimpl<A> TryInsert<A>where
A: ActiveModelTrait,
impl<A> TryInsert<A>where A: ActiveModelTrait,
sourcepub async fn exec<'a, C>(
self,
db: &'a C
) -> Result<TryInsertResult<InsertResult<A>>, DbErr>where
C: ConnectionTrait,
A: 'a,
pub async fn exec<'a, C>( self, db: &'a C ) -> Result<TryInsertResult<InsertResult<A>>, DbErr>where C: ConnectionTrait, A: 'a,
Execute an insert operation
sourcepub async fn exec_without_returning<'a, C>(
self,
db: &'a C
) -> Result<TryInsertResult<u64>, DbErr>where
<A::Entity as EntityTrait>::Model: IntoActiveModel<A>,
C: ConnectionTrait,
A: 'a,
pub async fn exec_without_returning<'a, C>( self, db: &'a C ) -> Result<TryInsertResult<u64>, DbErr>where <A::Entity as EntityTrait>::Model: IntoActiveModel<A>, C: ConnectionTrait, A: 'a,
Execute an insert operation without returning (donโt use RETURNING
syntax)
Number of rows affected is returned
sourcepub async fn exec_with_returning<'a, C>(
self,
db: &'a C
) -> Result<TryInsertResult<<A::Entity as EntityTrait>::Model>, DbErr>where
<A::Entity as EntityTrait>::Model: IntoActiveModel<A>,
C: ConnectionTrait,
A: 'a,
pub async fn exec_with_returning<'a, C>( self, db: &'a C ) -> Result<TryInsertResult<<A::Entity as EntityTrait>::Model>, DbErr>where <A::Entity as EntityTrait>::Model: IntoActiveModel<A>, C: ConnectionTrait, A: 'a,
Execute an insert operation and return the inserted model (use RETURNING
syntax if supported)
sourceยงimpl<A> TryInsert<A>where
A: ActiveModelTrait,
impl<A> TryInsert<A>where A: ActiveModelTrait,
pub fn one<M>(m: M) -> Selfwhere M: IntoActiveModel<A>,
pub fn many<M, I>(models: I) -> Selfwhere M: IntoActiveModel<A>, I: IntoIterator<Item = M>,
pub fn add<M>(self, m: M) -> Selfwhere M: IntoActiveModel<A>,
pub fn add_many<M, I>(self, models: I) -> Selfwhere M: IntoActiveModel<A>, I: IntoIterator<Item = M>,
pub fn on_conflict(self, on_conflict: OnConflict) -> Self
pub fn from_insert(insert: Insert<A>) -> Self
Trait Implementationsยง
sourceยงimpl<A> Default for TryInsert<A>where
A: ActiveModelTrait,
impl<A> Default for TryInsert<A>where A: ActiveModelTrait,
sourceยงimpl<A> QueryTrait for TryInsert<A>where
A: ActiveModelTrait,
impl<A> QueryTrait for TryInsert<A>where A: ActiveModelTrait,
ยงtype QueryStatement = InsertStatement
type QueryStatement = InsertStatement
Constrain the QueryStatement to QueryStatementBuilder trait
sourceยงfn query(&mut self) -> &mut InsertStatement
fn query(&mut self) -> &mut InsertStatement
Get a mutable ref to the query builder
sourceยงfn as_query(&self) -> &InsertStatement
fn as_query(&self) -> &InsertStatement
Get an immutable ref to the query builder
sourceยงfn into_query(self) -> InsertStatement
fn into_query(self) -> InsertStatement
Take ownership of the query builder
Auto Trait Implementationsยง
impl<A> !RefUnwindSafe for TryInsert<A>
impl<A> Send for TryInsert<A>where A: Send,
impl<A> Sync for TryInsert<A>where A: Sync,
impl<A> Unpin for TryInsert<A>where A: Unpin,
impl<A> !UnwindSafe for TryInsert<A>
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