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>
pub async fn exec_without_returning<'a, C>( self, db: &'a C, ) -> Result<TryInsertResult<u64>, DbErr>
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>
pub async fn exec_with_returning<'a, C>( self, db: &'a C, ) -> Result<TryInsertResult<<A::Entity as EntityTrait>::Model>, DbErr>
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,
Sourceยง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> Freeze for TryInsert<A>
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
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more