pub fn sql_sub(&self, other: &Self) -> Result<Self, Error> {
        Ok(match (self, other) {
            (Self::Number(lhs), Self::Number(rhs)) => try_from_number!(lhs.sub(*rhs), "{} - {}", lhs, rhs),
            (Self::Timestamp(ts, tz), Self::Interval(dur)) => Self::Timestamp(
                try_or_overflow!(
                    ts.checked_sub_signed(Duration::microseconds(*dur)),
                    "{} - {}us",
                    ts,
                    dur
                ),
                tz.clone(),
            ),
            (Self::Interval(a), Self::Interval(b)) => {
                Self::Interval(try_or_overflow!(a.checked_sub(*b), "{} + {}", a, b))
            }
            _ => {
                return Err(Error::InvalidArguments(format!(
                    "cannot subtract {} from {}",
                    self, other
                )));
            }
        })
    }
/// Subtracts two values using the rules common among SQL implementations.
Subtracts two values using the rules common among SQL implementations.
Subtracts two values using the rules common among SQL implementations .
pub fn sql_sub(&self, other: &Self) -> Result<Self, Error> {
        Ok(match (self, other) {
            (Self::Number(lhs), Self::Number(rhs)) => try_from_number!(lhs.sub(*rhs), "{} - {}", lhs, rhs),
            (Self::Timestamp(ts, tz), Self::Interval(dur)) => Self::Timestamp(
                try_or_overflow!(
                    ts.checked_sub_signed(Duration::microseconds(*dur)),
                    "{} - {}us",
                    ts,
                    dur
                ),
                tz.clone(),
            ),
            (Self::Interval(a), Self::Interval(b)) => {
                Self::Interval(try_or_overflow!(a.checked_sub(*b), "{} + {}", a, b))
            }
            _ => {
                return Err(Error::InvalidArguments(format!(
                    "cannot subtract {} from {}",
                    self, other
                )));
            }
        })
    }
pub fn sql_sub ( & self , other : & Self ) -> Result < Self , Error > { Ok ( match ( self , other ) { ( Self :: Number ( lhs ) , Self :: Number ( rhs ) ) => try_from_number ! ( lhs sub ( rhs ) " " lhs rhs ) , ( Self :: Timestamp ( ts , tz ) , Self :: Interval ( dur ) ) => Self :: Timestamp ( try_or_overflow ! ( ts checked_sub_signed ( Duration microseconds ( dur ) ) " " ts dur ) , tz . clone ( ) , ) , ( Self :: Interval ( a ) , Self :: Interval ( b ) ) => { Self :: Interval ( try_or_overflow ! ( a checked_sub ( b ) " " a b ) ) } _ => { return Err ( Error :: InvalidArguments ( format ! ( " " self other ) ) ) ; } } ) }
Subtracts two values using the rules common among SQL implementations.
Subtracts two values using the rules common among SQL implementations .
&self
other
&Self
&self
other
&Self