arel 0.2.9

a sql orm base sqlx
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{ActiveValue, Value};
use std::ops::Neg;

impl<V> Neg for ActiveValue<V>
where
    V: Into<Value> + Copy + PartialEq + Neg<Output = V> + Default,
{
    type Output = Self;
    fn neg(mut self) -> Self::Output {
        match &mut self {
            ActiveValue::Changed(nv, ov) => self = ActiveValue::Changed(-*nv, ov.clone()),
            ActiveValue::Unchanged(v) => self = ActiveValue::Changed(-*v, Box::new(self.clone())),
            ActiveValue::NotSet => self = ActiveValue::Changed(-V::default(), Box::new(ActiveValue::NotSet)),
        };
        self
    }
}