diesel/sqlite/expression/
operators.rs

1use crate::sql_types::Bool;
2use crate::sqlite::Sqlite;
3
4#[doc(hidden)]
pub struct Is<T, U> {
    pub(crate) left: T,
    pub(crate) right: U,
}
#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
    Is<T, U> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Is", "left",
            &self.left, "right", &&self.right)
    }
}
#[automatically_derived]
impl<T: ::core::clone::Clone, U: ::core::clone::Clone> ::core::clone::Clone
    for Is<T, U> {
    #[inline]
    fn clone(&self) -> Is<T, U> {
        Is {
            left: ::core::clone::Clone::clone(&self.left),
            right: ::core::clone::Clone::clone(&self.right),
        }
    }
}
#[automatically_derived]
impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy
    for Is<T, U> {
}
const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<T: diesel::query_builder::QueryId,
            U: diesel::query_builder::QueryId> diesel::query_builder::QueryId
            for Is<T, U> {
            type QueryId =
                Is<<T as diesel::query_builder::QueryId>::QueryId,
                <U as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        <U as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                    && true;
            const IS_WINDOW_FUNCTION: bool =
                <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        <U as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };
const _: () =
    {
        use diesel;
        use diesel::internal::derives::numeric_ops as ops;
        use diesel::expression::{Expression, AsExpression};
        use diesel::sql_types::ops::{Add, Sub, Mul, Div};
        use diesel::sql_types::{SqlType, SingleValue};
        impl<T, U, __Rhs> ::std::ops::Add<__Rhs> for Is<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Add,
            <<Self as Expression>::SqlType as Add>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Add>::Rhs> {
            type Output = ops::Add<Self, __Rhs::Expression>;
            fn add(self, rhs: __Rhs) -> Self::Output {
                ops::Add::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Sub<__Rhs> for Is<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Sub,
            <<Self as Expression>::SqlType as Sub>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Sub>::Rhs> {
            type Output = ops::Sub<Self, __Rhs::Expression>;
            fn sub(self, rhs: __Rhs) -> Self::Output {
                ops::Sub::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Mul<__Rhs> for Is<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Mul,
            <<Self as Expression>::SqlType as Mul>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Mul>::Rhs> {
            type Output = ops::Mul<Self, __Rhs::Expression>;
            fn mul(self, rhs: __Rhs) -> Self::Output {
                ops::Mul::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Div<__Rhs> for Is<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Div,
            <<Self as Expression>::SqlType as Div>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Div>::Rhs> {
            type Output = ops::Div<Self, __Rhs::Expression>;
            fn div(self, rhs: __Rhs) -> Self::Output {
                ops::Div::new(self, rhs.as_expression())
            }
        }
    };
const _: () =
    {
        use diesel;
        impl<T, U, __GroupByClause>
            diesel::expression::ValidGrouping<__GroupByClause> for Is<T, U>
            where T: diesel::expression::ValidGrouping<__GroupByClause>,
            U: diesel::expression::ValidGrouping<__GroupByClause>,
            <T as
            diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<U
            as
            diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
            {
            type IsAggregate =
                <<T as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<U as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
        }
    };
impl<T, U> Is<T, U> {
    pub(crate) fn new(left: T, right: U) -> Self { Is { left, right } }
}
impl<T, U, QS> crate::expression::SelectableExpression<QS> for Is<T, U> where
    Is<T, U>: crate::expression::AppearsOnTable<QS>,
    T: crate::expression::SelectableExpression<QS>,
    U: crate::expression::SelectableExpression<QS> {}
impl<T, U, QS> crate::expression::AppearsOnTable<QS> for Is<T, U> where
    Is<T, U>: crate::expression::Expression,
    T: crate::expression::AppearsOnTable<QS>,
    U: crate::expression::AppearsOnTable<QS> {}
impl<T, U> crate::expression::Expression for Is<T, U> where
    T: crate::expression::Expression, U: crate::expression::Expression,
    <T as crate::expression::Expression>::SqlType: crate::sql_types::SqlType,
    <U as crate::expression::Expression>::SqlType: crate::sql_types::SqlType {
    type SqlType = Bool;
}
impl<T, U> crate::query_builder::QueryFragment<Sqlite> for Is<T, U> where
    T: crate::query_builder::QueryFragment<Sqlite>,
    U: crate::query_builder::QueryFragment<Sqlite> {
    fn walk_ast<'b>(&'b self,
        mut out: crate::query_builder::AstPass<'_, 'b, Sqlite>)
        -> crate::result::QueryResult<()> {
        self.left.walk_ast(out.reborrow())?;
        out.push_sql(" IS ");
        self.right.walk_ast(out.reborrow())?;
        ;
        Ok(())
    }
}
impl<S, T, U> crate::internal::operators_macro::FieldAliasMapper<S> for
    Is<T, U> where S: crate::query_source::AliasSource,
    T: crate::internal::operators_macro::FieldAliasMapper<S>,
    U: crate::internal::operators_macro::FieldAliasMapper<S> {
    type Out =
        Is<<T as crate::internal::operators_macro::FieldAliasMapper<S>>::Out,
        <U as crate::internal::operators_macro::FieldAliasMapper<S>>::Out>;
    fn map(self, alias: &crate::query_source::Alias<S>) -> Self::Out {
        Is { left: self.left.map(alias), right: self.right.map(alias) }
    }
}__diesel_infix_operator!(Is, " IS ", ConstantNullability Bool, backend: Sqlite);
5#[doc(hidden)]
pub struct IsNot<T, U> {
    pub(crate) left: T,
    pub(crate) right: U,
}
#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
    IsNot<T, U> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "IsNot", "left",
            &self.left, "right", &&self.right)
    }
}
#[automatically_derived]
impl<T: ::core::clone::Clone, U: ::core::clone::Clone> ::core::clone::Clone
    for IsNot<T, U> {
    #[inline]
    fn clone(&self) -> IsNot<T, U> {
        IsNot {
            left: ::core::clone::Clone::clone(&self.left),
            right: ::core::clone::Clone::clone(&self.right),
        }
    }
}
#[automatically_derived]
impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy
    for IsNot<T, U> {
}
const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<T: diesel::query_builder::QueryId,
            U: diesel::query_builder::QueryId> diesel::query_builder::QueryId
            for IsNot<T, U> {
            type QueryId =
                IsNot<<T as diesel::query_builder::QueryId>::QueryId,
                <U as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        <U as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                    && true;
            const IS_WINDOW_FUNCTION: bool =
                <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        <U as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };
const _: () =
    {
        use diesel;
        use diesel::internal::derives::numeric_ops as ops;
        use diesel::expression::{Expression, AsExpression};
        use diesel::sql_types::ops::{Add, Sub, Mul, Div};
        use diesel::sql_types::{SqlType, SingleValue};
        impl<T, U, __Rhs> ::std::ops::Add<__Rhs> for IsNot<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Add,
            <<Self as Expression>::SqlType as Add>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Add>::Rhs> {
            type Output = ops::Add<Self, __Rhs::Expression>;
            fn add(self, rhs: __Rhs) -> Self::Output {
                ops::Add::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Sub<__Rhs> for IsNot<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Sub,
            <<Self as Expression>::SqlType as Sub>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Sub>::Rhs> {
            type Output = ops::Sub<Self, __Rhs::Expression>;
            fn sub(self, rhs: __Rhs) -> Self::Output {
                ops::Sub::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Mul<__Rhs> for IsNot<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Mul,
            <<Self as Expression>::SqlType as Mul>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Mul>::Rhs> {
            type Output = ops::Mul<Self, __Rhs::Expression>;
            fn mul(self, rhs: __Rhs) -> Self::Output {
                ops::Mul::new(self, rhs.as_expression())
            }
        }
        impl<T, U, __Rhs> ::std::ops::Div<__Rhs> for IsNot<T, U> where
            Self: Expression, Self: Expression,
            <Self as Expression>::SqlType: Div,
            <<Self as Expression>::SqlType as Div>::Rhs: SqlType +
            SingleValue,
            __Rhs: AsExpression<<<Self as Expression>::SqlType as Div>::Rhs> {
            type Output = ops::Div<Self, __Rhs::Expression>;
            fn div(self, rhs: __Rhs) -> Self::Output {
                ops::Div::new(self, rhs.as_expression())
            }
        }
    };
const _: () =
    {
        use diesel;
        impl<T, U, __GroupByClause>
            diesel::expression::ValidGrouping<__GroupByClause> for IsNot<T, U>
            where T: diesel::expression::ValidGrouping<__GroupByClause>,
            U: diesel::expression::ValidGrouping<__GroupByClause>,
            <T as
            diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<U
            as
            diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
            {
            type IsAggregate =
                <<T as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<U as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
        }
    };
impl<T, U> IsNot<T, U> {
    pub(crate) fn new(left: T, right: U) -> Self { IsNot { left, right } }
}
impl<T, U, QS> crate::expression::SelectableExpression<QS> for IsNot<T, U>
    where IsNot<T, U>: crate::expression::AppearsOnTable<QS>,
    T: crate::expression::SelectableExpression<QS>,
    U: crate::expression::SelectableExpression<QS> {}
impl<T, U, QS> crate::expression::AppearsOnTable<QS> for IsNot<T, U> where
    IsNot<T, U>: crate::expression::Expression,
    T: crate::expression::AppearsOnTable<QS>,
    U: crate::expression::AppearsOnTable<QS> {}
impl<T, U> crate::expression::Expression for IsNot<T, U> where
    T: crate::expression::Expression, U: crate::expression::Expression,
    <T as crate::expression::Expression>::SqlType: crate::sql_types::SqlType,
    <U as crate::expression::Expression>::SqlType: crate::sql_types::SqlType {
    type SqlType = Bool;
}
impl<T, U> crate::query_builder::QueryFragment<Sqlite> for IsNot<T, U> where
    T: crate::query_builder::QueryFragment<Sqlite>,
    U: crate::query_builder::QueryFragment<Sqlite> {
    fn walk_ast<'b>(&'b self,
        mut out: crate::query_builder::AstPass<'_, 'b, Sqlite>)
        -> crate::result::QueryResult<()> {
        self.left.walk_ast(out.reborrow())?;
        out.push_sql(" IS NOT ");
        self.right.walk_ast(out.reborrow())?;
        ;
        Ok(())
    }
}
impl<S, T, U> crate::internal::operators_macro::FieldAliasMapper<S> for
    IsNot<T, U> where S: crate::query_source::AliasSource,
    T: crate::internal::operators_macro::FieldAliasMapper<S>,
    U: crate::internal::operators_macro::FieldAliasMapper<S> {
    type Out =
        IsNot<<T as
        crate::internal::operators_macro::FieldAliasMapper<S>>::Out,
        <U as crate::internal::operators_macro::FieldAliasMapper<S>>::Out>;
    fn map(self, alias: &crate::query_source::Alias<S>) -> Self::Out {
        IsNot { left: self.left.map(alias), right: self.right.map(alias) }
    }
}__diesel_infix_operator!(IsNot, " IS NOT ", ConstantNullability Bool, backend: Sqlite);