Struct sea_orm::entity::ActiveValue[][src]

pub struct ActiveValue<V> where
    V: Into<Value>, 
{ /* fields omitted */ }
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

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.