ActiveModel

Struct ActiveModel 

Source
pub struct ActiveModel {
    pub id: ActiveValue<ResourceId>,
    pub schema: ActiveValue<Option<String>>,
    pub table: ActiveValue<String>,
}
Available on crate feature rbac only.
Expand description

Generated by sea-orm-macros

Fieldsยง

ยงid: ActiveValue<ResourceId>

Generated by sea-orm-macros

ยงschema: ActiveValue<Option<String>>

Generated by sea-orm-macros

ยงtable: ActiveValue<String>

Generated by sea-orm-macros

Trait Implementationsยง

Sourceยง

impl ActiveModelBehavior for ActiveModel

Sourceยง

fn new() -> Self

Create a new ActiveModel with default values. This is also called by Default::default(). Read more
Sourceยง

fn before_save<C>(self, db: &C, insert: bool) -> Result<Self, DbErr>
where C: ConnectionTrait,

Will be called before ActiveModel::insert, ActiveModel::update, and ActiveModel::save
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,

Will be called after ActiveModel::insert, ActiveModel::update, and ActiveModel::save
Sourceยง

fn before_delete<C>(self, db: &C) -> Result<Self, DbErr>
where C: ConnectionTrait,

Will be called before ActiveModel::delete
Sourceยง

fn after_delete<C>(self, db: &C) -> Result<Self, DbErr>
where C: ConnectionTrait,

Will be called after ActiveModel::delete
Sourceยง

impl ActiveModelTrait for ActiveModel

Sourceยง

type Entity = Entity

The Entity this ActiveModel belongs to
Sourceยง

fn take( &mut self, c: <Self::Entity as EntityTrait>::Column, ) -> ActiveValue<Value>

Get a mutable ActiveValue from an ActiveModel
Sourceยง

fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> ActiveValue<Value>

Get a immutable ActiveValue from an ActiveModel
Sourceยง

fn set_if_not_equals( &mut self, c: <Self::Entity as EntityTrait>::Column, v: Value, )

Set the Value of a ActiveModel field if value is different, panic if failed
Sourceยง

fn try_set( &mut self, c: <Self::Entity as EntityTrait>::Column, v: Value, ) -> Result<(), DbErr>

Set the Value of a ActiveModel field, return error if failed
Sourceยง

fn not_set(&mut self, c: <Self::Entity as EntityTrait>::Column)

Set the state of an ActiveValue to the not set state
Sourceยง

fn is_not_set(&self, c: <Self::Entity as EntityTrait>::Column) -> bool

Check the state of a ActiveValue
Sourceยง

fn reset(&mut self, c: <Self::Entity as EntityTrait>::Column)

Reset the value from ActiveValue::Unchanged to ActiveValue::Set, leaving ActiveValue::NotSet untouched.
Sourceยง

fn default_values() -> Self

Create an ActiveModel with all fields to Set(default_value) if Default is implemented, NotSet otherwise
Sourceยง

fn default() -> Self

Create an ActiveModel with all fields to NotSet
Sourceยง

fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value)

Set the Value of a ActiveModel field, panic if failed
Sourceยง

fn reset_all(self) -> Self

Reset all values from ActiveValue::Unchanged to ActiveValue::Set, leaving ActiveValue::NotSet untouched.
Sourceยง

fn get_primary_key_value(&self) -> Option<ValueTuple>

Get the primary key of the ActiveModel, only if itโ€™s fully specified.
Sourceยง

fn insert<'a, C>( self, db: &'a C, ) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>

Perform an INSERT operation on the ActiveModel Read more
Sourceยง

fn update<'a, C>( self, db: &'a C, ) -> Result<<Self::Entity as EntityTrait>::Model, DbErr>

Perform the UPDATE operation on an ActiveModel Read more
Sourceยง

fn save<'a, C>(self, db: &'a C) -> Result<Self, DbErr>

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>

Delete an active model by its primary key Read more
Sourceยง

fn is_changed(&self) -> bool

Return true if any attribute of ActiveModel is Set
Find related Models belonging to self
Sourceยง

impl Clone for ActiveModel

Sourceยง

fn clone(&self) -> ActiveModel

Returns a duplicate of the value. Read more
1.0.0ยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for ActiveModel

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl Default for ActiveModel

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl From<Model> for ActiveModel

Sourceยง

fn from(m: Model) -> Self

Converts to this type from the input type.
Sourceยง

impl IntoActiveModel<ActiveModel> for Model

Sourceยง

fn into_active_model(self) -> ActiveModel

Method to call to perform the conversion
Sourceยง

impl PartialEq for ActiveModel

Sourceยง

fn eq(&self, other: &ActiveModel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0ยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl TryFrom<ActiveModel> for Model

Sourceยง

type Error = DbErr

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

fn try_from(a: ActiveModel) -> Result<Self, DbErr>

Performs the conversion.
Sourceยง

impl TryIntoModel<Model> for ActiveModel

Sourceยง

fn try_into_model(self) -> Result<Model, DbErr>

Method to call to perform the conversion
Sourceยง

impl StructuralPartialEq for ActiveModel

Auto Trait Implementationsยง

Blanket Implementationsยง

ยง

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

ยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
ยง

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

ยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
ยง

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

ยง

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

Mutably borrows from an owned value. Read more
ยง

impl<T> CloneToUninit for T
where T: Clone,

ยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
ยง

impl<T> From<T> for T

ยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
ยง

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

ยง

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<A> IntoActiveModel<A> for A

Sourceยง

fn into_active_model(self) -> A

Method to call to perform the conversion
Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
ยง

impl<T> ToOwned for T
where T: Clone,

ยง

type Owned = T

The resulting type after obtaining ownership.
ยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
ยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
ยง

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

ยง

type Error = Infallible

The type returned in the event of a conversion error.
ยง

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

Performs the conversion.
ยง

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

ยง

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

The type returned in the event of a conversion error.
ยง

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

Performs the conversion.
Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more