Skip to main content

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

Build a fresh ActiveModel. Defaults to ActiveModelTrait::default (every column NotSet); override to pre-fill columns: Read more
Sourceยง

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,

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,

Hook invoked before delete. Return an error to abort.
Sourceยง

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

Hook invoked after delete succeeds.
Sourceยง

impl ActiveModelTrait for ActiveModel

Sourceยง

type Entity = Entity

The EntityTrait this ActiveModel belongs to.
Sourceยง

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>

Read the ActiveValue of a column.
Sourceยง

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>

Set one column to Set(v), returning an error on type mismatch.
Sourceยง

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

true if the column is currently in the NotSet state.
Sourceยง

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

Promote one column from Unchanged to Set so it will be included in the next UPDATE. Leaves NotSet untouched.
Sourceยง

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 default() -> Self

A fresh ActiveModel with every column NotSet.
Sourceยง

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 reset_all(self) -> Self

Apply reset to every column, forcing the next UPDATE to write all non-NotSet columns.
Sourceยง

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>

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 update_without_returning<'a, C>( self, db: &'a C, ) -> Result<UpdateResult, DbErr>

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

Available on crate feature with-arrow only.
Convert a slice of ActiveModels into an Arrow RecordBatch. 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 (const: unstable) ยท Sourceยง

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 (const: unstable) ยท Sourceยง

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 StructuralPartialEq for ActiveModel

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>

Attempt the conversion, returning an error if a required column is not set.

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Sourceยง

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

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

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

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

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

Sourceยง

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

Mutably borrows from an owned value. Read more
Sourceยง

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

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

Sourceยง

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

impl<T> From<T> for T

Sourceยง

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

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

Sourceยง

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Sourceยง

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

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

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

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

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

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

Sourceยง

type Error = Infallible

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

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

Performs the conversion.
Sourceยง

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

Sourceยง

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

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

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