pub fn sql_cmp(&self, other: &Self) -> Result<Option<Ordering>, Error> {
        Ok(match (self, other) {
            (Self::Null, _) | (_, Self::Null) => None,
            (Self::Number(a), Self::Number(b)) => a.partial_cmp(b),
            (Self::Bytes(a), Self::Bytes(b)) => a.partial_cmp(b),
            (Self::Timestamp(a, _), Self::Timestamp(b, _)) => a.partial_cmp(b),
            (Self::Interval(a), Self::Interval(b)) => a.partial_cmp(b),
            (Self::Array(a), Self::Array(b)) => try_partial_cmp_by(a.iter(), b.iter(), |a, b| a.sql_cmp(b))?,
            _ => {
                return Err(Error::InvalidArguments(format!(
                    "cannot compare {} with {}",
                    self, other
                )));
            }
        })
    }
/// Compares two values using the rules common among SQL implementations.
///
/// * Comparing with NULL always return `None`.
/// * Numbers and intervals are ordered by value.
/// * Timestamps are ordered by its UTC value, ignoring time zone.
/// * Strings are ordered by UTF-8 binary collation.
/// * Arrays are ordered lexicographically.
/// * Comparing between different types are inconsistent among database
///     engines, thus this function will just error with `InvalidArguments`.
Compares two values using the rules common among SQL implementations.
Comparing with NULL always return `None`.
Numbers and intervals are ordered by value.
Timestamps are ordered by its UTC value, ignoring time zone.
Strings are ordered by UTF-8 binary collation.
Arrays are ordered lexicographically.
Comparing between different types are inconsistent among database
engines, thus this function will just error with `InvalidArguments`.
Compares two values using the rules common among SQL implementations . Comparing with NULL always return ` None ` . Numbers and intervals are ordered by value . Timestamps are ordered by its UTC value ignoring time zone . Strings are ordered by UTF - 8 binary collation . Arrays are ordered lexicographically . Comparing between different types are inconsistent among database engines thus this function will just error with ` InvalidArguments ` .
pub fn sql_cmp(&self, other: &Self) -> Result<Option<Ordering>, Error> {
        Ok(match (self, other) {
            (Self::Null, _) | (_, Self::Null) => None,
            (Self::Number(a), Self::Number(b)) => a.partial_cmp(b),
            (Self::Bytes(a), Self::Bytes(b)) => a.partial_cmp(b),
            (Self::Timestamp(a, _), Self::Timestamp(b, _)) => a.partial_cmp(b),
            (Self::Interval(a), Self::Interval(b)) => a.partial_cmp(b),
            (Self::Array(a), Self::Array(b)) => try_partial_cmp_by(a.iter(), b.iter(), |a, b| a.sql_cmp(b))?,
            _ => {
                return Err(Error::InvalidArguments(format!(
                    "cannot compare {} with {}",
                    self, other
                )));
            }
        })
    }
pub fn sql_cmp ( & self , other : & Self ) -> Result < Option < Ordering > , Error > { Ok ( match ( self , other ) { ( Self :: Null , _ ) | ( _ , Self :: Null ) => None , ( Self :: Number ( a ) , Self :: Number ( b ) ) => a . partial_cmp ( b ) , ( Self :: Bytes ( a ) , Self :: Bytes ( b ) ) => a . partial_cmp ( b ) , ( Self :: Timestamp ( a , _ ) , Self :: Timestamp ( b , _ ) ) => a . partial_cmp ( b ) , ( Self :: Interval ( a ) , Self :: Interval ( b ) ) => a . partial_cmp ( b ) , ( Self :: Array ( a ) , Self :: Array ( b ) ) => try_partial_cmp_by ( a . iter ( ) , b . iter ( ) , | a , b | a . sql_cmp ( b ) ) ? , _ => { return Err ( Error :: InvalidArguments ( format ! ( " " self other ) ) ) ; } } ) }
Compares two values using the rules common among SQL implementations.
Compares two values using the rules common among SQL implementations .
&self
other
&Self
&self
other
&Self