Enum UpdateTarget
pub enum UpdateTarget {
Query(Box<Query>),
Model(ModelId),
Table(TableId),
}Expand description
The target of an Update statement.
Specifies what entity is being updated. At the model level this is a model ID or a scoped query. After lowering, it becomes a table ID.
§Examples
ⓘ
use toasty_core::stmt::UpdateTarget;
use toasty_core::schema::app::ModelId;
let target = UpdateTarget::Model(ModelId(0));
assert_eq!(target.model_id(), Some(ModelId(0)));Variants§
Query(Box<Query>)
Update records returned by a query. The query must select a model.
Model(ModelId)
Update a model by its ID.
Table(TableId)
Update a database table (lowered form).
Implementations§
§impl UpdateTarget
impl UpdateTarget
pub fn model_id_unwrap(&self) -> ModelId
pub fn model_id_unwrap(&self) -> ModelId
pub fn table(table: impl Into<TableId>) -> UpdateTarget
pub fn table(table: impl Into<TableId>) -> UpdateTarget
Creates a Table target from a table ID.
pub fn as_table_unwrap(&self) -> TableId
pub fn as_table_unwrap(&self) -> TableId
Returns the table ID, panicking if this is not a Table variant.
§Panics
Panics if this is not a Table variant.
Trait Implementations§
§impl Clone for UpdateTarget
impl Clone for UpdateTarget
§fn clone(&self) -> UpdateTarget
fn clone(&self) -> UpdateTarget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for UpdateTarget
impl Debug for UpdateTarget
§impl<'a, T> IntoExprTarget<'a, T> for &'a UpdateTargetwhere
T: Resolve,
impl<'a, T> IntoExprTarget<'a, T> for &'a UpdateTargetwhere
T: Resolve,
§fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
Converts
self into an ExprTarget using the provided schema.§impl PartialEq for UpdateTarget
impl PartialEq for UpdateTarget
impl StructuralPartialEq for UpdateTarget
Auto Trait Implementations§
impl Freeze for UpdateTarget
impl RefUnwindSafe for UpdateTarget
impl Send for UpdateTarget
impl Sync for UpdateTarget
impl Unpin for UpdateTarget
impl UnwindSafe for UpdateTarget
Blanket Implementations§
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