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