use super::Value;
#[derive(Clone, Debug, PartialEq)]
pub enum ActiveValue<V>
where
V: Into<Value> + Clone,
{
Changed(V, Box<ActiveValue<V>>),
Unchanged(V),
NotSet,
}
impl<V> ActiveValue<V>
where
V: Into<Value> + Clone,
{
pub fn set<UV>(&mut self, uv: UV) -> &mut Self
where
UV: Into<V>,
{
match self {
Self::Changed(nv, _) => {
*nv = uv.into();
}
_ => *self = ActiveValue::Changed(uv.into(), Box::new(self.clone())),
}
self
}
}