Struct sea_orm::entity::ActiveValue [−][src]
Expand description
Defines a value from an ActiveModel and its state.
The field value takes in an Option type where Option::Some(V) , with V holding
the value that operations like UPDATE are being performed on and
the state field is either ActiveValueState::Set or ActiveValueState::Unchanged.
Option::None in the value field indicates no value being performed by an operation
and that the state field of the ActiveValue is set to ActiveValueState::Unset .
Example snippet
// The code snipped below does an UPDATE operation on a [ActiveValue]
// yielding the the SQL statement ` r#"UPDATE "fruit" SET "name" = 'Orange' WHERE "fruit"."id" = 1"# `
use sea_orm::tests_cfg::{cake, fruit};
use sea_orm::{entity::*, query::*, DbBackend};
Update::one(fruit::ActiveModel {
id: ActiveValue::set(1),
name: ActiveValue::set("Orange".to_owned()),
cake_id: ActiveValue::unset(),
})
.build(DbBackend::Postgres)
.to_string();Implementations
Set the value of an ActiveValue and also set its state to ActiveValueState::Set
Check if the state of an ActiveValue is ActiveValueState::Set which returns true
Check if the status of the ActiveValue is ActiveValueState::Unchanged
which returns true if it is
Set the value field of the ActiveModel to Option::None and the
state field to ActiveValueState::Unset
Check if the state of an ActiveValue is ActiveValueState::Unset
which returns true if it is
Get the mutable value of the value field of an ActiveValue
also setting it’s state to ActiveValueState::Unset
Get an owned value of the value field of the ActiveValue
Check is a Value exists or not
Wrap the Value into a ActiveValue<Value>
Trait Implementations
Returns the “default value” for a type. Read more
Performs the conversion.
Auto Trait Implementations
impl<V> RefUnwindSafe for ActiveValue<V> where
V: RefUnwindSafe,
impl<V> Send for ActiveValue<V> where
V: Send,
impl<V> Sync for ActiveValue<V> where
V: Sync,
impl<V> Unpin for ActiveValue<V> where
V: Unpin,
impl<V> UnwindSafe for ActiveValue<V> where
V: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more