pub struct ActiveModel {
pub id: ActiveValue<RoleId>,
pub role: ActiveValue<String>,
}Available on crate feature
rbac only.Expand description
Generated by sea-orm-macros
Fieldsยง
ยงid: ActiveValue<RoleId>Generated by sea-orm-macros
role: ActiveValue<String>Generated by sea-orm-macros
Trait Implementationsยง
Sourceยงimpl ActiveModelBehavior for ActiveModel
impl ActiveModelBehavior for ActiveModel
Sourceยงfn new() -> Self
fn new() -> Self
Build a fresh ActiveModel. Defaults to
ActiveModelTrait::default
(every column NotSet); override to pre-fill columns: Read moreSourceยงfn before_save<C>(self, db: &C, insert: bool) -> Result<Self, DbErr>where
C: ConnectionTrait,
fn before_save<C>(self, db: &C, insert: bool) -> Result<Self, DbErr>where
C: ConnectionTrait,
Hook invoked before
insert, update, and save. insert is true
for inserts. Return an error to abort the operation.Sourceยงfn after_save<C>(
model: <Self::Entity as EntityTrait>::Model,
db: &C,
insert: bool,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
C: ConnectionTrait,
fn after_save<C>(
model: <Self::Entity as EntityTrait>::Model,
db: &C,
insert: bool,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
C: ConnectionTrait,
Hook invoked after
insert, update, and save succeed. Receives
(and may transform) the resulting Model.Sourceยงfn before_delete<C>(self, db: &C) -> Result<Self, DbErr>where
C: ConnectionTrait,
fn before_delete<C>(self, db: &C) -> Result<Self, DbErr>where
C: ConnectionTrait,
Hook invoked before
delete. Return an error to abort.Sourceยงfn after_delete<C>(self, db: &C) -> Result<Self, DbErr>where
C: ConnectionTrait,
fn after_delete<C>(self, db: &C) -> Result<Self, DbErr>where
C: ConnectionTrait,
Hook invoked after
delete succeeds.Sourceยงimpl ActiveModelTrait for ActiveModel
impl ActiveModelTrait for ActiveModel
Sourceยงtype Entity = Entity
type Entity = Entity
The
EntityTrait this ActiveModel belongs to.Sourceยงfn take(
&mut self,
c: <Self::Entity as EntityTrait>::Column,
) -> ActiveValue<Value>
fn take( &mut self, c: <Self::Entity as EntityTrait>::Column, ) -> ActiveValue<Value>
Take the
ActiveValue of a column, leaving it as NotSet.Sourceยงfn get(&self, c: <Self::Entity as EntityTrait>::Column) -> ActiveValue<Value>
fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> ActiveValue<Value>
Read the
ActiveValue of a column.Sourceยงfn set_if_not_equals(
&mut self,
c: <Self::Entity as EntityTrait>::Column,
v: Value,
)
fn set_if_not_equals( &mut self, c: <Self::Entity as EntityTrait>::Column, v: Value, )
Set one column to
Set(v) only if v differs from the current value,
avoiding spurious UPDATE rewrites. Panics on type mismatch.Sourceยงfn try_set(
&mut self,
c: <Self::Entity as EntityTrait>::Column,
v: Value,
) -> Result<(), DbErr>
fn try_set( &mut self, c: <Self::Entity as EntityTrait>::Column, v: Value, ) -> Result<(), DbErr>
Set one column to
Set(v), returning an error on type mismatch.Sourceยงfn not_set(&mut self, c: <Self::Entity as EntityTrait>::Column)
fn not_set(&mut self, c: <Self::Entity as EntityTrait>::Column)
Mark a column as
NotSet so it is omitted from the next INSERT or
UPDATE.Sourceยงfn is_not_set(&self, c: <Self::Entity as EntityTrait>::Column) -> bool
fn is_not_set(&self, c: <Self::Entity as EntityTrait>::Column) -> bool
true if the column is currently in the NotSet state.Sourceยงfn default_values() -> Self
fn default_values() -> Self
A fresh ActiveModel pre-populated with
Set(default_value) for each
column that has a Default impl; other columns remain NotSet.Sourceยงfn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value)
fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value)
Set one column to
Set(v). Panics on type mismatch; prefer
try_set when the value comes from untrusted input.Sourceยงfn get_primary_key_value(&self) -> Option<ValueTuple>
fn get_primary_key_value(&self) -> Option<ValueTuple>
The primary key as a
ValueTuple, or None if any primary-key
column is still NotSet.Sourceยงfn insert<'a, C>(
self,
db: &'a C,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
fn insert<'a, C>(
self,
db: &'a C,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
Perform an
INSERT operation on the ActiveModel Read moreSourceยงfn update<'a, C>(
self,
db: &'a C,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
fn update<'a, C>(
self,
db: &'a C,
) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
Perform the
UPDATE operation on an ActiveModel Read moreSourceยงfn update_without_returning<'a, C>(
self,
db: &'a C,
) -> Result<UpdateResult, DbErr>where
Self: ActiveModelBehavior,
C: ConnectionTrait,
fn update_without_returning<'a, C>(
self,
db: &'a C,
) -> Result<UpdateResult, DbErr>where
Self: ActiveModelBehavior,
C: ConnectionTrait,
Update an ActiveModel without a RETURNING clause, yielding an
UpdateResult instead of the updated model. Useful on backends without
RETURNING support, or when the updated model is not needed. Read moreSourceยงfn save<'a, C>(self, db: &'a C) -> Result<Self, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
fn save<'a, C>(self, db: &'a C) -> Result<Self, DbErr>where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
Self: ActiveModelBehavior,
C: ConnectionTrait,
Insert the model if primary key is
NotSet, update otherwise.
Only works if the entity has auto increment primary key.Sourceยงfn delete<'a, C>(self, db: &'a C) -> Result<DeleteResult, DbErr>where
Self: ActiveModelBehavior,
C: ConnectionTrait,
fn delete<'a, C>(self, db: &'a C) -> Result<DeleteResult, DbErr>where
Self: ActiveModelBehavior,
C: ConnectionTrait,
Delete an active model by its primary key Read more
Sourceยงfn from_arrow(batch: &RecordBatch) -> Result<Vec<Self>, DbErr>
fn from_arrow(batch: &RecordBatch) -> Result<Vec<Self>, DbErr>
Available on crate feature
with-arrow only.Create a Vec of ActiveModels from an Arrow RecordBatch. Read more
Sourceยงfn to_arrow(models: &[Self], schema: &Schema) -> Result<RecordBatch, DbErr>
fn to_arrow(models: &[Self], schema: &Schema) -> Result<RecordBatch, DbErr>
Available on crate feature
with-arrow only.Convert a slice of ActiveModels into an Arrow
RecordBatch. Read moreSourceยงfn is_changed(&self) -> bool
fn is_changed(&self) -> bool
Return
true if any attribute of ActiveModel is SetFind related Models belonging to self
Sourceยงimpl Clone for ActiveModel
impl Clone for ActiveModel
Sourceยงfn clone(&self) -> ActiveModel
fn clone(&self) -> ActiveModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl Debug for ActiveModel
impl Debug for ActiveModel
Sourceยงimpl Default for ActiveModel
impl Default for ActiveModel
Sourceยงimpl From<Model> for ActiveModel
impl From<Model> for ActiveModel
Sourceยงimpl IntoActiveModel<ActiveModel> for Model
impl IntoActiveModel<ActiveModel> for Model
Sourceยงfn into_active_model(self) -> ActiveModel
fn into_active_model(self) -> ActiveModel
Method to call to perform the conversion
Sourceยงimpl PartialEq for ActiveModel
impl PartialEq for ActiveModel
Sourceยงfn eq(&self, other: &ActiveModel) -> bool
fn eq(&self, other: &ActiveModel) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ActiveModel
Sourceยงimpl TryFrom<ActiveModel> for Model
impl TryFrom<ActiveModel> for Model
Sourceยงimpl TryIntoModel<Model> for ActiveModel
impl TryIntoModel<Model> for ActiveModel
Auto Trait Implementationsยง
impl Freeze for ActiveModel
impl RefUnwindSafe for ActiveModel
impl Send for ActiveModel
impl Sync for ActiveModel
impl Unpin for ActiveModel
impl UnsafeUnpin for ActiveModel
impl UnwindSafe for ActiveModel
Blanket Implementationsยง
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<A> IntoActiveModel<A> for Awhere
A: ActiveModelTrait,
impl<A> IntoActiveModel<A> for Awhere
A: ActiveModelTrait,
Sourceยงfn into_active_model(self) -> A
fn into_active_model(self) -> A
Method to call to perform the conversion
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