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(&mut self, v: V) -> &mut Self {
match self {
Self::Changed(nv, _) => {
*nv = v;
}
_ => *self = ActiveValue::Changed(v, Box::new(self.clone())),
}
self
}
}