Skip to main content

diesel/pg/expression/
functions.rs

1//! PostgreSQL specific functions
2
3use super::expression_methods::InetOrCidr;
4use crate::expression::functions::declare_sql_function;
5use crate::pg::expression::expression_methods::ArrayOrNullableArray;
6use crate::pg::expression::expression_methods::CombinedAllNullableValue;
7use crate::pg::expression::expression_methods::JsonOrNullableJson;
8use crate::pg::expression::expression_methods::JsonbOrNullableJsonb;
9use crate::pg::expression::expression_methods::MaybeNullableValue;
10use crate::pg::expression::expression_methods::MultirangeOrNullableMultirange;
11use crate::pg::expression::expression_methods::MultirangeOrRangeMaybeNullable;
12use crate::pg::expression::expression_methods::RangeOrNullableRange;
13use crate::pg::expression::expression_methods::RecordOrNullableRecord;
14use crate::pg::expression::expression_methods::TextArrayOrNullableTextArray;
15use crate::pg::expression::expression_methods::TextOrNullableText;
16use crate::sql_types::helper::CombinedNullableValue;
17use crate::sql_types::*;
18
19#[doc = " Creates an abbreviated display format as text."]
#[allow(non_camel_case_types)]
pub fn abbrev<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> abbrev<T, addr> where addr: diesel::expression::AsExpression<T> {
    abbrev_utils::abbrev {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`abbrev()`](fn@abbrev)"]
pub type abbrev<T, addr> =
    abbrev_utils::abbrev<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __abbrev_return_type {
    #[doc = "Return type of the [`abbrev()`](fn@super::abbrev) SQL function."]
    pub type abbrev<addr> =
        super::abbrev<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod abbrev_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct abbrev<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for abbrev<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for abbrev<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for abbrev<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for abbrev<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for abbrev<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "abbrev",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for abbrev<T, addr> {
        #[inline]
        fn clone(&self) -> abbrev<T, addr> {
            abbrev {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for abbrev<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for abbrev<T, addr> {
                type QueryId =
                    abbrev<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`abbrev()`](fn@abbrev)"]
    pub type HelperType<T, addr> =
        abbrev<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for abbrev<T, addr>
        where (addr): Expression {
        type SqlType = Text;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for abbrev<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for abbrev<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for abbrev<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "abbrev";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        abbrev<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for abbrev<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Computes the broadcast address for the address\'s network."]
#[allow(non_camel_case_types)]
pub fn broadcast<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> broadcast<T, addr> where addr: diesel::expression::AsExpression<T> {
    broadcast_utils::broadcast {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`broadcast()`](fn@broadcast)"]
pub type broadcast<T, addr> =
    broadcast_utils::broadcast<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __broadcast_return_type {
    #[doc =
    "Return type of the [`broadcast()`](fn@super::broadcast) SQL function."]
    pub type broadcast<addr> =
        super::broadcast<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod broadcast_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct broadcast<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for
                broadcast<T, addr> 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, addr, __Rhs> ::core::ops::Sub<__Rhs> for
                broadcast<T, addr> 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, addr, __Rhs> ::core::ops::Mul<__Rhs> for
                broadcast<T, addr> 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, addr, __Rhs> ::core::ops::Div<__Rhs> for
                broadcast<T, addr> 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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for broadcast<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "broadcast",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for broadcast<T, addr> {
        #[inline]
        fn clone(&self) -> broadcast<T, addr> {
            broadcast {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for broadcast<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for broadcast<T, addr> {
                type QueryId =
                    broadcast<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`broadcast()`](fn@broadcast)"]
    pub type HelperType<T, addr> =
        broadcast<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for broadcast<T, addr>
        where (addr): Expression {
        type SqlType = Inet;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for broadcast<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for broadcast<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for broadcast<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "broadcast";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        broadcast<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for broadcast<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the address\'s family: 4 for IPv4, 6 for IPv6."]
#[allow(non_camel_case_types)]
pub fn family<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> family<T, addr> where addr: diesel::expression::AsExpression<T> {
    family_utils::family {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`family()`](fn@family)"]
pub type family<T, addr> =
    family_utils::family<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __family_return_type {
    #[doc = "Return type of the [`family()`](fn@super::family) SQL function."]
    pub type family<addr> =
        super::family<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod family_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct family<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for family<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for family<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for family<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for family<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for family<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "family",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for family<T, addr> {
        #[inline]
        fn clone(&self) -> family<T, addr> {
            family {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for family<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for family<T, addr> {
                type QueryId =
                    family<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`family()`](fn@family)"]
    pub type HelperType<T, addr> =
        family<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for family<T, addr>
        where (addr): Expression {
        type SqlType = Integer;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for family<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for family<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for family<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "family";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        family<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for family<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the IP address as text, ignoring the netmask."]
#[allow(non_camel_case_types)]
pub fn host<T: InetOrCidr + SingleValue, addr>(addr: addr) -> host<T, addr>
    where addr: diesel::expression::AsExpression<T> {
    host_utils::host {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`host()`](fn@host)"]
pub type host<T, addr> =
    host_utils::host<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __host_return_type {
    #[doc = "Return type of the [`host()`](fn@super::host) SQL function."]
    pub type host<addr> =
        super::host<<addr as diesel::expression::Expression>::SqlType, addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod host_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct host<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for host<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for host<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for host<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for host<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for host<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "host",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for host<T, addr> {
        #[inline]
        fn clone(&self) -> host<T, addr> {
            host {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for host<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for host<T, addr> {
                type QueryId =
                    host<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`host()`](fn@host)"]
    pub type HelperType<T, addr> =
        host<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for host<T, addr> where
        (addr): Expression {
        type SqlType = Text;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for host<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for host<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for host<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "host";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        host<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for host<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Computes the host mask for the address\'s network."]
#[allow(non_camel_case_types)]
pub fn hostmask<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> hostmask<T, addr> where addr: diesel::expression::AsExpression<T> {
    hostmask_utils::hostmask {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`hostmask()`](fn@hostmask)"]
pub type hostmask<T, addr> =
    hostmask_utils::hostmask<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __hostmask_return_type {
    #[doc =
    "Return type of the [`hostmask()`](fn@super::hostmask) SQL function."]
    pub type hostmask<addr> =
        super::hostmask<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod hostmask_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct hostmask<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for hostmask<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for hostmask<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for hostmask<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for hostmask<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for hostmask<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "hostmask",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for hostmask<T, addr> {
        #[inline]
        fn clone(&self) -> hostmask<T, addr> {
            hostmask {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for hostmask<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for hostmask<T, addr> {
                type QueryId =
                    hostmask<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`hostmask()`](fn@hostmask)"]
    pub type HelperType<T, addr> =
        hostmask<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for hostmask<T, addr>
        where (addr): Expression {
        type SqlType = Inet;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for hostmask<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for hostmask<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for hostmask<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "hostmask";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        hostmask<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for hostmask<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Computes the smallest network that includes both of the given networks."]
#[allow(non_camel_case_types)]
pub fn inet_merge<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a,
    b>(a: a, b: b) -> inet_merge<T, U, a, b> where
    a: diesel::expression::AsExpression<T>,
    b: diesel::expression::AsExpression<U> {
    inet_merge_utils::inet_merge {
        a: a.as_expression(),
        b: b.as_expression(),
        T: ::core::marker::PhantomData,
        U: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`inet_merge()`](fn@inet_merge)"]
pub type inet_merge<T, U, a, b> =
    inet_merge_utils::inet_merge<T, U,
    <a as diesel::expression::AsExpression<T>>::Expression,
    <b as diesel::expression::AsExpression<U>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __inet_merge_return_type {
    #[doc =
    "Return type of the [`inet_merge()`](fn@super::inet_merge) SQL function."]
    pub type inet_merge<a, b> =
        super::inet_merge<<a as diesel::expression::Expression>::SqlType,
        <b as diesel::expression::Expression>::SqlType, a, b>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod inet_merge_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct inet_merge<T, U, a, b> {
        pub(in super) a: a,
        pub(in super) b: b,
        pub(in super) T: ::core::marker::PhantomData<T>,
        pub(in super) U: ::core::marker::PhantomData<U>,
    }
    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, a, b, __Rhs> ::core::ops::Add<__Rhs> for
                inet_merge<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Sub<__Rhs> for
                inet_merge<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Mul<__Rhs> for
                inet_merge<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Div<__Rhs> for
                inet_merge<T, U, a, b> 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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug, a: ::core::fmt::Debug,
        b: ::core::fmt::Debug> ::core::fmt::Debug for inet_merge<T, U, a, b> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "inet_merge", "a", &self.a, "b", &self.b, "T", &self.T, "U",
                &&self.U)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, U: ::core::clone::Clone,
        a: ::core::clone::Clone, b: ::core::clone::Clone> ::core::clone::Clone
        for inet_merge<T, U, a, b> {
        #[inline]
        fn clone(&self) -> inet_merge<T, U, a, b> {
            inet_merge {
                a: ::core::clone::Clone::clone(&self.a),
                b: ::core::clone::Clone::clone(&self.b),
                T: ::core::clone::Clone::clone(&self.T),
                U: ::core::clone::Clone::clone(&self.U),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, U: ::core::marker::Copy,
        a: ::core::marker::Copy, b: ::core::marker::Copy> ::core::marker::Copy
        for inet_merge<T, U, a, b> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                U: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                b: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for inet_merge<T, U, a, b> {
                type QueryId =
                    inet_merge<<T as diesel::query_builder::QueryId>::QueryId,
                    <U as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <b 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
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <b 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 ||
                                <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <b as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`inet_merge()`](fn@inet_merge)"]
    pub type HelperType<T, U, a, b> =
        inet_merge<T, U, <a as AsExpression<T>>::Expression,
        <b as AsExpression<U>>::Expression>;
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b>
        Expression for inet_merge<T, U, a, b> where (a, b): Expression {
        type SqlType = Cidr;
    }
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        inet_merge<T, U, a, b> where
        a: SelectableExpression<__DieselInternal>,
        b: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        inet_merge<T, U, a, b> where a: AppearsOnTable<__DieselInternal>,
        b: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        inet_merge<T, U, a, b> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, b: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "inet_merge";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.b.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.b.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b>
        QueryFragment<crate::pg::Pg> for inet_merge<T, U, a, b> where
        a: QueryFragment<crate::pg::Pg>, b: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, b>(a, b);
    const _: () =
        {
            use diesel;
            impl<a, b, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, b> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                b: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<b
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<b as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        inet_merge<T, U, a, b> where
        __Derived<a, b>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, b> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Tests whether the addresses belong to the same IP family."]
#[allow(non_camel_case_types)]
pub fn inet_same_family<T: InetOrCidr + SingleValue, U: InetOrCidr +
    SingleValue, a, b>(a: a, b: b) -> inet_same_family<T, U, a, b> where
    a: diesel::expression::AsExpression<T>,
    b: diesel::expression::AsExpression<U> {
    inet_same_family_utils::inet_same_family {
        a: a.as_expression(),
        b: b.as_expression(),
        T: ::core::marker::PhantomData,
        U: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`inet_same_family()`](fn@inet_same_family)"]
pub type inet_same_family<T, U, a, b> =
    inet_same_family_utils::inet_same_family<T, U,
    <a as diesel::expression::AsExpression<T>>::Expression,
    <b as diesel::expression::AsExpression<U>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __inet_same_family_return_type {
    #[doc =
    "Return type of the [`inet_same_family()`](fn@super::inet_same_family) SQL function."]
    pub type inet_same_family<a, b> =
        super::inet_same_family<<a as
        diesel::expression::Expression>::SqlType,
        <b as diesel::expression::Expression>::SqlType, a, b>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod inet_same_family_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct inet_same_family<T, U, a, b> {
        pub(in super) a: a,
        pub(in super) b: b,
        pub(in super) T: ::core::marker::PhantomData<T>,
        pub(in super) U: ::core::marker::PhantomData<U>,
    }
    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, a, b, __Rhs> ::core::ops::Add<__Rhs> for
                inet_same_family<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Sub<__Rhs> for
                inet_same_family<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Mul<__Rhs> for
                inet_same_family<T, U, a, b> 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, a, b, __Rhs> ::core::ops::Div<__Rhs> for
                inet_same_family<T, U, a, b> 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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug, a: ::core::fmt::Debug,
        b: ::core::fmt::Debug> ::core::fmt::Debug for
        inet_same_family<T, U, a, b> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "inet_same_family", "a", &self.a, "b", &self.b, "T", &self.T,
                "U", &&self.U)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, U: ::core::clone::Clone,
        a: ::core::clone::Clone, b: ::core::clone::Clone> ::core::clone::Clone
        for inet_same_family<T, U, a, b> {
        #[inline]
        fn clone(&self) -> inet_same_family<T, U, a, b> {
            inet_same_family {
                a: ::core::clone::Clone::clone(&self.a),
                b: ::core::clone::Clone::clone(&self.b),
                T: ::core::clone::Clone::clone(&self.T),
                U: ::core::clone::Clone::clone(&self.U),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, U: ::core::marker::Copy,
        a: ::core::marker::Copy, b: ::core::marker::Copy> ::core::marker::Copy
        for inet_same_family<T, U, a, b> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                U: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                b: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                inet_same_family<T, U, a, b> {
                type QueryId =
                    inet_same_family<<T as
                    diesel::query_builder::QueryId>::QueryId,
                    <U as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <b 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
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <b 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 ||
                                <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <b as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`inet_same_family()`](fn@inet_same_family)"]
    pub type HelperType<T, U, a, b> =
        inet_same_family<T, U, <a as AsExpression<T>>::Expression,
        <b as AsExpression<U>>::Expression>;
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b>
        Expression for inet_same_family<T, U, a, b> where (a, b): Expression {
        type SqlType = Bool;
    }
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        inet_same_family<T, U, a, b> where
        a: SelectableExpression<__DieselInternal>,
        b: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        inet_same_family<T, U, a, b> where
        a: AppearsOnTable<__DieselInternal>,
        b: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        inet_same_family<T, U, a, b> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, b: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "inet_same_family";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.b.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.b.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b>
        QueryFragment<crate::pg::Pg> for inet_same_family<T, U, a, b> where
        a: QueryFragment<crate::pg::Pg>, b: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, b>(a, b);
    const _: () =
        {
            use diesel;
            impl<a, b, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, b> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                b: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<b
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<b as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue, a, b,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        inet_same_family<T, U, a, b> where
        __Derived<a, b>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, b> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the netmask length in bits."]
#[allow(non_camel_case_types)]
pub fn masklen<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> masklen<T, addr> where addr: diesel::expression::AsExpression<T> {
    masklen_utils::masklen {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`masklen()`](fn@masklen)"]
pub type masklen<T, addr> =
    masklen_utils::masklen<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __masklen_return_type {
    #[doc =
    "Return type of the [`masklen()`](fn@super::masklen) SQL function."]
    pub type masklen<addr> =
        super::masklen<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod masklen_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct masklen<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for masklen<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for masklen<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for masklen<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for masklen<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for masklen<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "masklen",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for masklen<T, addr> {
        #[inline]
        fn clone(&self) -> masklen<T, addr> {
            masklen {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for masklen<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for masklen<T, addr> {
                type QueryId =
                    masklen<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`masklen()`](fn@masklen)"]
    pub type HelperType<T, addr> =
        masklen<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for masklen<T, addr>
        where (addr): Expression {
        type SqlType = Integer;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for masklen<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for masklen<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for masklen<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "masklen";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        masklen<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for masklen<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Computes the network mask for the address\'s network."]
#[allow(non_camel_case_types)]
pub fn netmask<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> netmask<T, addr> where addr: diesel::expression::AsExpression<T> {
    netmask_utils::netmask {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`netmask()`](fn@netmask)"]
pub type netmask<T, addr> =
    netmask_utils::netmask<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __netmask_return_type {
    #[doc =
    "Return type of the [`netmask()`](fn@super::netmask) SQL function."]
    pub type netmask<addr> =
        super::netmask<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod netmask_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct netmask<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for netmask<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for netmask<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for netmask<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for netmask<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for netmask<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "netmask",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for netmask<T, addr> {
        #[inline]
        fn clone(&self) -> netmask<T, addr> {
            netmask {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for netmask<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for netmask<T, addr> {
                type QueryId =
                    netmask<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`netmask()`](fn@netmask)"]
    pub type HelperType<T, addr> =
        netmask<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for netmask<T, addr>
        where (addr): Expression {
        type SqlType = Inet;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for netmask<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for netmask<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for netmask<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "netmask";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        netmask<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for netmask<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns the network part of the address, zeroing out whatever is to the right of the"]
#[doc = " netmask. (This is equivalent to casting the value to cidr.)"]
#[allow(non_camel_case_types)]
pub fn network<T: InetOrCidr + SingleValue, addr>(addr: addr)
    -> network<T, addr> where addr: diesel::expression::AsExpression<T> {
    network_utils::network {
        addr: addr.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`network()`](fn@network)"]
pub type network<T, addr> =
    network_utils::network<T,
    <addr as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __network_return_type {
    #[doc =
    "Return type of the [`network()`](fn@super::network) SQL function."]
    pub type network<addr> =
        super::network<<addr as diesel::expression::Expression>::SqlType,
        addr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod network_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct network<T, addr> {
        pub(in super) addr: addr,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, __Rhs> ::core::ops::Add<__Rhs> for network<T, addr>
                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, addr, __Rhs> ::core::ops::Sub<__Rhs> for network<T, addr>
                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, addr, __Rhs> ::core::ops::Mul<__Rhs> for network<T, addr>
                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, addr, __Rhs> ::core::ops::Div<__Rhs> for network<T, addr>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug> ::core::fmt::Debug
        for network<T, addr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "network",
                "addr", &self.addr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone>
        ::core::clone::Clone for network<T, addr> {
        #[inline]
        fn clone(&self) -> network<T, addr> {
            network {
                addr: ::core::clone::Clone::clone(&self.addr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy>
        ::core::marker::Copy for network<T, addr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for network<T, addr> {
                type QueryId =
                    network<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <addr as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`network()`](fn@network)"]
    pub type HelperType<T, addr> =
        network<T, <addr as AsExpression<T>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr> Expression for network<T, addr>
        where (addr): Expression {
        type SqlType = Cidr;
    }
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        SelectableExpression<__DieselInternal> for network<T, addr> where
        addr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for network<T, addr> where
        addr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        FunctionFragment<__DieselInternal> for network<T, addr> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "network";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr> QueryFragment<crate::pg::Pg> for
        network<T, addr> where addr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr>(addr);
    const _: () =
        {
            use diesel;
            impl<addr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr> where
                addr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, __DieselInternal>
        ValidGrouping<__DieselInternal> for network<T, addr> where
        __Derived<addr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Sets the netmask length for an inet or cidr value."]
#[doc =
" For inet, the address part does not changes. For cidr, address bits to the right of the new"]
#[doc = " netmask are set to zero."]
#[allow(non_camel_case_types)]
pub fn set_masklen<T: InetOrCidr + SingleValue, addr,
    len>(addr: addr, len: len) -> set_masklen<T, addr, len> where
    addr: diesel::expression::AsExpression<T>,
    len: diesel::expression::AsExpression<Integer> {
    set_masklen_utils::set_masklen {
        addr: addr.as_expression(),
        len: len.as_expression(),
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`set_masklen()`](fn@set_masklen)"]
pub type set_masklen<T, addr, len> =
    set_masklen_utils::set_masklen<T,
    <addr as diesel::expression::AsExpression<T>>::Expression,
    <len as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __set_masklen_return_type {
    #[doc =
    "Return type of the [`set_masklen()`](fn@super::set_masklen) SQL function."]
    pub type set_masklen<addr, len> =
        super::set_masklen<<addr as diesel::expression::Expression>::SqlType,
        addr, len>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod set_masklen_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct set_masklen<T, addr, len> {
        pub(in super) addr: addr,
        pub(in super) len: len,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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, addr, len, __Rhs> ::core::ops::Add<__Rhs> for
                set_masklen<T, addr, len> 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, addr, len, __Rhs> ::core::ops::Sub<__Rhs> for
                set_masklen<T, addr, len> 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, addr, len, __Rhs> ::core::ops::Mul<__Rhs> for
                set_masklen<T, addr, len> 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, addr, len, __Rhs> ::core::ops::Div<__Rhs> for
                set_masklen<T, addr, len> 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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, addr: ::core::fmt::Debug,
        len: ::core::fmt::Debug> ::core::fmt::Debug for
        set_masklen<T, addr, len> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "set_masklen", "addr", &self.addr, "len", &self.len, "T",
                &&self.T)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, addr: ::core::clone::Clone,
        len: ::core::clone::Clone> ::core::clone::Clone for
        set_masklen<T, addr, len> {
        #[inline]
        fn clone(&self) -> set_masklen<T, addr, len> {
            set_masklen {
                addr: ::core::clone::Clone::clone(&self.addr),
                len: ::core::clone::Clone::clone(&self.len),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, addr: ::core::marker::Copy,
        len: ::core::marker::Copy> ::core::marker::Copy for
        set_masklen<T, addr, len> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                addr: diesel::query_builder::QueryId,
                len: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for set_masklen<T, addr, len> {
                type QueryId =
                    set_masklen<<T as diesel::query_builder::QueryId>::QueryId,
                    <addr as diesel::query_builder::QueryId>::QueryId,
                    <len as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <addr as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <len as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <addr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <len as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`set_masklen()`](fn@set_masklen)"]
    pub type HelperType<T, addr, len> =
        set_masklen<T, <addr as AsExpression<T>>::Expression,
        <len as AsExpression<Integer>>::Expression>;
    impl<T: InetOrCidr + SingleValue, addr, len> Expression for
        set_masklen<T, addr, len> where (addr, len): Expression {
        type SqlType = T;
    }
    impl<T: InetOrCidr + SingleValue, addr, len, __DieselInternal>
        SelectableExpression<__DieselInternal> for set_masklen<T, addr, len>
        where addr: SelectableExpression<__DieselInternal>,
        len: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: InetOrCidr + SingleValue, addr, len, __DieselInternal>
        AppearsOnTable<__DieselInternal> for set_masklen<T, addr, len> where
        addr: AppearsOnTable<__DieselInternal>,
        len: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: InetOrCidr + SingleValue, addr, len, __DieselInternal>
        FunctionFragment<__DieselInternal> for set_masklen<T, addr, len> where
        __DieselInternal: diesel::backend::Backend,
        addr: QueryFragment<__DieselInternal>,
        len: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "set_masklen";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.addr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.addr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.len.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.len.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: InetOrCidr + SingleValue, addr, len> QueryFragment<crate::pg::Pg>
        for set_masklen<T, addr, len> where
        addr: QueryFragment<crate::pg::Pg>, len: QueryFragment<crate::pg::Pg>
        {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<addr, len>(addr, len);
    const _: () =
        {
            use diesel;
            impl<addr, len, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<addr, len> where
                addr: diesel::expression::ValidGrouping<__GroupByClause>,
                len: diesel::expression::ValidGrouping<__GroupByClause>,
                <addr as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<len
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<addr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<len as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<T: InetOrCidr + SingleValue, addr, len, __DieselInternal>
        ValidGrouping<__DieselInternal> for set_masklen<T, addr, len> where
        __Derived<addr, len>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<addr, len> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the lower bound of the range"]
#[doc = ""]
#[doc = " If the range is empty or has no lower bound, it returns NULL."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::lower;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let int = diesel::select(lower::<Range<_>, _>(1..2)).get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(1), int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower::<Range<_>, _>(..2)).get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower::<Nullable<Range<_>>, _>(None::<std::ops::Range<i32>>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(lower::<Multirange<_>, _>(vec![5..7]))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(5), int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn lower<R: MultirangeOrRangeMaybeNullable + SingleValue,
    range>(range: range) -> lower<R, range> where
    range: diesel::expression::AsExpression<R> {
    lower_utils::lower {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`lower()`](fn@lower)"]
pub type lower<R, range> =
    lower_utils::lower<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __lower_return_type {
    #[doc = "Return type of the [`lower()`](fn@super::lower) SQL function."]
    pub type lower<range> =
        super::lower<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod lower_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct lower<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for lower<R, range>
                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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for lower<R, range>
                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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for lower<R, range>
                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<R, range, __Rhs> ::core::ops::Div<__Rhs> for lower<R, range>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for lower<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "lower",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for lower<R, range> {
        #[inline]
        fn clone(&self) -> lower<R, range> {
            lower {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for lower<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for lower<R, range> {
                type QueryId =
                    lower<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`lower()`](fn@lower)"]
    pub type HelperType<R, range> =
        lower<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range> Expression
        for lower<R, range> where (range): Expression {
        type SqlType = Nullable<R::Inner>;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        lower<R, range> where range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> AppearsOnTable<__DieselInternal> for lower<R, range>
        where range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        lower<R, range> where __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "lower";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range>
        QueryFragment<crate::pg::Pg> for lower<R, range> where
        range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> ValidGrouping<__DieselInternal> for lower<R, range>
        where __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the upper bound of the range"]
#[doc = ""]
#[doc = " If the range is empty or has no upper bound, it returns NULL."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::upper;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let int = diesel::select(upper::<Range<_>, _>(1..2)).get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(2), int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(upper::<Range<_>, _>(1..)).get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(upper::<Nullable<Range<_>>, _>(None::<std::ops::Range<i32>>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(upper::<Multirange<_>, _>(vec![5..7]))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(7), int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn upper<R: MultirangeOrRangeMaybeNullable + SingleValue,
    range>(range: range) -> upper<R, range> where
    range: diesel::expression::AsExpression<R> {
    upper_utils::upper {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`upper()`](fn@upper)"]
pub type upper<R, range> =
    upper_utils::upper<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __upper_return_type {
    #[doc = "Return type of the [`upper()`](fn@super::upper) SQL function."]
    pub type upper<range> =
        super::upper<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod upper_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct upper<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for upper<R, range>
                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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for upper<R, range>
                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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for upper<R, range>
                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<R, range, __Rhs> ::core::ops::Div<__Rhs> for upper<R, range>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for upper<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "upper",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for upper<R, range> {
        #[inline]
        fn clone(&self) -> upper<R, range> {
            upper {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for upper<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for upper<R, range> {
                type QueryId =
                    upper<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`upper()`](fn@upper)"]
    pub type HelperType<R, range> =
        upper<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range> Expression
        for upper<R, range> where (range): Expression {
        type SqlType = Nullable<R::Inner>;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        upper<R, range> where range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> AppearsOnTable<__DieselInternal> for upper<R, range>
        where range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        upper<R, range> where __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "upper";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range>
        QueryFragment<crate::pg::Pg> for upper<R, range> where
        range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue, range,
        __DieselInternal> ValidGrouping<__DieselInternal> for upper<R, range>
        where __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns true if the range is empty"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::isempty;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let int = diesel::select(isempty::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(isempty::<Range<Integer>, _>(1..1)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(true, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(isempty::<Nullable<Range<Integer>>, _>("]
#[doc = "     None::<std::ops::Range<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<bool>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(isempty::<Multirange<Integer>, _>(vec![5..7]))"]
#[doc = "     .get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn isempty<R: MultirangeOrRangeMaybeNullable + SingleValue +
    MaybeNullableValue<Bool>, range>(range: range) -> isempty<R, range> where
    range: diesel::expression::AsExpression<R> {
    isempty_utils::isempty {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`isempty()`](fn@isempty)"]
pub type isempty<R, range> =
    isempty_utils::isempty<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __isempty_return_type {
    #[doc =
    "Return type of the [`isempty()`](fn@super::isempty) SQL function."]
    pub type isempty<range> =
        super::isempty<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod isempty_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct isempty<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for
                isempty<R, range> 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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for
                isempty<R, range> 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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for
                isempty<R, range> 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<R, range, __Rhs> ::core::ops::Div<__Rhs> for
                isempty<R, range> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for isempty<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "isempty",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for isempty<R, range> {
        #[inline]
        fn clone(&self) -> isempty<R, range> {
            isempty {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for isempty<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for isempty<R, range> {
                type QueryId =
                    isempty<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`isempty()`](fn@isempty)"]
    pub type HelperType<R, range> =
        isempty<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> Expression for isempty<R, range>
        where (range): Expression {
        type SqlType = R::Out;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        SelectableExpression<__DieselInternal> for isempty<R, range> where
        range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        AppearsOnTable<__DieselInternal> for isempty<R, range> where
        range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        FunctionFragment<__DieselInternal> for isempty<R, range> where
        __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "isempty";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> QueryFragment<crate::pg::Pg> for
        isempty<R, range> where range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        ValidGrouping<__DieselInternal> for isempty<R, range> where
        __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns true if the range\'s lower bound is inclusive"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::lower_inc;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = " let int ="]
#[doc =
"     diesel::select(lower_inc::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(true, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower_inc::<Range<Integer>, _>(..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(lower_inc::<Nullable<Range<Integer>>, _>("]
#[doc = "     None::<std::ops::Range<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<bool>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower_inc::<Multirange<Integer>, _>(vec![5..7]))"]
#[doc = "     .get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(true, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn lower_inc<R: MultirangeOrRangeMaybeNullable + SingleValue +
    MaybeNullableValue<Bool>, range>(range: range) -> lower_inc<R, range>
    where range: diesel::expression::AsExpression<R> {
    lower_inc_utils::lower_inc {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`lower_inc()`](fn@lower_inc)"]
pub type lower_inc<R, range> =
    lower_inc_utils::lower_inc<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __lower_inc_return_type {
    #[doc =
    "Return type of the [`lower_inc()`](fn@super::lower_inc) SQL function."]
    pub type lower_inc<range> =
        super::lower_inc<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod lower_inc_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct lower_inc<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for
                lower_inc<R, range> 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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for
                lower_inc<R, range> 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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for
                lower_inc<R, range> 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<R, range, __Rhs> ::core::ops::Div<__Rhs> for
                lower_inc<R, range> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for lower_inc<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "lower_inc",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for lower_inc<R, range> {
        #[inline]
        fn clone(&self) -> lower_inc<R, range> {
            lower_inc {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for lower_inc<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for lower_inc<R, range> {
                type QueryId =
                    lower_inc<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`lower_inc()`](fn@lower_inc)"]
    pub type HelperType<R, range> =
        lower_inc<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> Expression for lower_inc<R, range>
        where (range): Expression {
        type SqlType = R::Out;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        SelectableExpression<__DieselInternal> for lower_inc<R, range> where
        range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        AppearsOnTable<__DieselInternal> for lower_inc<R, range> where
        range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        FunctionFragment<__DieselInternal> for lower_inc<R, range> where
        __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "lower_inc";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> QueryFragment<crate::pg::Pg> for
        lower_inc<R, range> where range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        ValidGrouping<__DieselInternal> for lower_inc<R, range> where
        __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns true if the range\'s upper bound is inclusive"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::upper_inc;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = " let int ="]
#[doc =
"     diesel::select(upper_inc::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(upper_inc::<Nullable<Range<Integer>>, _>("]
#[doc = "     None::<std::ops::Range<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<bool>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(upper_inc::<Multirange<Integer>, _>(vec![5..7]))"]
#[doc = "     .get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn upper_inc<R: MultirangeOrRangeMaybeNullable + SingleValue +
    MaybeNullableValue<Bool>, range>(range: range) -> upper_inc<R, range>
    where range: diesel::expression::AsExpression<R> {
    upper_inc_utils::upper_inc {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`upper_inc()`](fn@upper_inc)"]
pub type upper_inc<R, range> =
    upper_inc_utils::upper_inc<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __upper_inc_return_type {
    #[doc =
    "Return type of the [`upper_inc()`](fn@super::upper_inc) SQL function."]
    pub type upper_inc<range> =
        super::upper_inc<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod upper_inc_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct upper_inc<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for
                upper_inc<R, range> 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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for
                upper_inc<R, range> 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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for
                upper_inc<R, range> 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<R, range, __Rhs> ::core::ops::Div<__Rhs> for
                upper_inc<R, range> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for upper_inc<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "upper_inc",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for upper_inc<R, range> {
        #[inline]
        fn clone(&self) -> upper_inc<R, range> {
            upper_inc {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for upper_inc<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for upper_inc<R, range> {
                type QueryId =
                    upper_inc<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`upper_inc()`](fn@upper_inc)"]
    pub type HelperType<R, range> =
        upper_inc<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> Expression for upper_inc<R, range>
        where (range): Expression {
        type SqlType = R::Out;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        SelectableExpression<__DieselInternal> for upper_inc<R, range> where
        range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        AppearsOnTable<__DieselInternal> for upper_inc<R, range> where
        range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        FunctionFragment<__DieselInternal> for upper_inc<R, range> where
        __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "upper_inc";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> QueryFragment<crate::pg::Pg> for
        upper_inc<R, range> where range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        ValidGrouping<__DieselInternal> for upper_inc<R, range> where
        __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns true if the range\'s lower bound is unbounded"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::lower_inf;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = " let int ="]
#[doc =
"     diesel::select(lower_inf::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower_inf::<Range<Integer>, _>(..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(true, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(lower_inf::<Nullable<Range<Integer>>, _>("]
#[doc = "     None::<std::ops::Range<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<bool>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(lower_inf::<Multirange<Integer>, _>(vec![5..7]))"]
#[doc = "     .get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn lower_inf<R: MultirangeOrRangeMaybeNullable + SingleValue +
    MaybeNullableValue<Bool>, range>(range: range) -> lower_inf<R, range>
    where range: diesel::expression::AsExpression<R> {
    lower_inf_utils::lower_inf {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`lower_inf()`](fn@lower_inf)"]
pub type lower_inf<R, range> =
    lower_inf_utils::lower_inf<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __lower_inf_return_type {
    #[doc =
    "Return type of the [`lower_inf()`](fn@super::lower_inf) SQL function."]
    pub type lower_inf<range> =
        super::lower_inf<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod lower_inf_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct lower_inf<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for
                lower_inf<R, range> 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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for
                lower_inf<R, range> 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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for
                lower_inf<R, range> 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<R, range, __Rhs> ::core::ops::Div<__Rhs> for
                lower_inf<R, range> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for lower_inf<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "lower_inf",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for lower_inf<R, range> {
        #[inline]
        fn clone(&self) -> lower_inf<R, range> {
            lower_inf {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for lower_inf<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for lower_inf<R, range> {
                type QueryId =
                    lower_inf<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`lower_inf()`](fn@lower_inf)"]
    pub type HelperType<R, range> =
        lower_inf<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> Expression for lower_inf<R, range>
        where (range): Expression {
        type SqlType = R::Out;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        SelectableExpression<__DieselInternal> for lower_inf<R, range> where
        range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        AppearsOnTable<__DieselInternal> for lower_inf<R, range> where
        range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        FunctionFragment<__DieselInternal> for lower_inf<R, range> where
        __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "lower_inf";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> QueryFragment<crate::pg::Pg> for
        lower_inf<R, range> where range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        ValidGrouping<__DieselInternal> for lower_inf<R, range> where
        __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns true if the range\'s upper bound is unbounded"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::upper_inf;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = " let int ="]
#[doc =
"     diesel::select(upper_inf::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(upper_inf::<Range<Integer>, _>(1..)).get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(true, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(upper_inf::<Nullable<Range<Integer>>, _>("]
#[doc = "     None::<std::ops::Range<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<bool>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(upper_inf::<Multirange<Integer>, _>(vec![5..7]))"]
#[doc = "     .get_result::<bool>(connection)?;"]
#[doc = " assert_eq!(false, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn upper_inf<R: MultirangeOrRangeMaybeNullable + SingleValue +
    MaybeNullableValue<Bool>, range>(range: range) -> upper_inf<R, range>
    where range: diesel::expression::AsExpression<R> {
    upper_inf_utils::upper_inf {
        range: range.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`upper_inf()`](fn@upper_inf)"]
pub type upper_inf<R, range> =
    upper_inf_utils::upper_inf<R,
    <range as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __upper_inf_return_type {
    #[doc =
    "Return type of the [`upper_inf()`](fn@super::upper_inf) SQL function."]
    pub type upper_inf<range> =
        super::upper_inf<<range as diesel::expression::Expression>::SqlType,
        range>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod upper_inf_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct upper_inf<R, range> {
        pub(in super) range: range,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, range, __Rhs> ::core::ops::Add<__Rhs> for
                upper_inf<R, range> 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<R, range, __Rhs> ::core::ops::Sub<__Rhs> for
                upper_inf<R, range> 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<R, range, __Rhs> ::core::ops::Mul<__Rhs> for
                upper_inf<R, range> 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<R, range, __Rhs> ::core::ops::Div<__Rhs> for
                upper_inf<R, range> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, range: ::core::fmt::Debug> ::core::fmt::Debug
        for upper_inf<R, range> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "upper_inf",
                "range", &self.range, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, range: ::core::clone::Clone>
        ::core::clone::Clone for upper_inf<R, range> {
        #[inline]
        fn clone(&self) -> upper_inf<R, range> {
            upper_inf {
                range: ::core::clone::Clone::clone(&self.range),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, range: ::core::marker::Copy>
        ::core::marker::Copy for upper_inf<R, range> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                range: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for upper_inf<R, range> {
                type QueryId =
                    upper_inf<<R as diesel::query_builder::QueryId>::QueryId,
                    <range as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <range as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <range as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`upper_inf()`](fn@upper_inf)"]
    pub type HelperType<R, range> =
        upper_inf<R, <range as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> Expression for upper_inf<R, range>
        where (range): Expression {
        type SqlType = R::Out;
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        SelectableExpression<__DieselInternal> for upper_inf<R, range> where
        range: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        AppearsOnTable<__DieselInternal> for upper_inf<R, range> where
        range: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        FunctionFragment<__DieselInternal> for upper_inf<R, range> where
        __DieselInternal: diesel::backend::Backend,
        range: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "upper_inf";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.range.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.range.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range> QueryFragment<crate::pg::Pg> for
        upper_inf<R, range> where range: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<range>(range);
    const _: () =
        {
            use diesel;
            impl<range, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<range> where
                range: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <range as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrRangeMaybeNullable + SingleValue +
        MaybeNullableValue<Bool>, range, __DieselInternal>
        ValidGrouping<__DieselInternal> for upper_inf<R, range> where
        __Derived<range>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<range> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the smallest range which includes both of the given ranges"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::range_merge;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let int = diesel::select(range_merge::<Range<Integer>, Range<_>, _, _>(5..11, 10..))"]
#[doc = "     .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;"]
#[doc = " assert_eq!((Bound::Included(5), Bound::Unbounded), int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(range_merge::<Range<Integer>, Range<_>, _, _>(1..3, 7..10))"]
#[doc = "     .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;"]
#[doc = " assert_eq!((Bound::Included(1), Bound::Excluded(10)), int);"]
#[doc = ""]
#[doc = " let int = diesel::select(range_merge::<"]
#[doc = "     Nullable<Range<Integer>>,"]
#[doc = "     Nullable<Range<_>>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >(None::<std::ops::Range<i32>>, 7..10))"]
#[doc = " .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = ""]
#[doc = " let int = diesel::select(range_merge::<"]
#[doc = "     Nullable<Range<Integer>>,"]
#[doc = "     Nullable<Range<_>>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >(1..3, None::<std::ops::Range<i32>>))"]
#[doc = " .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn range_merge<R1: RangeOrNullableRange + SingleValue,
    R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
    CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs>(lhs: lhs, rhs: rhs)
    -> range_merge<R1, R2, lhs, rhs> where
    lhs: diesel::expression::AsExpression<R1>,
    rhs: diesel::expression::AsExpression<R2> {
    range_merge_utils::range_merge {
        lhs: lhs.as_expression(),
        rhs: rhs.as_expression(),
        R1: ::core::marker::PhantomData,
        R2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`range_merge()`](fn@range_merge)"]
pub type range_merge<R1, R2, lhs, rhs> =
    range_merge_utils::range_merge<R1, R2,
    <lhs as diesel::expression::AsExpression<R1>>::Expression,
    <rhs as diesel::expression::AsExpression<R2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __range_merge_return_type {
    #[doc =
    "Return type of the [`range_merge()`](fn@super::range_merge) SQL function."]
    pub type range_merge<lhs, rhs> =
        super::range_merge<<lhs as diesel::expression::Expression>::SqlType,
        <rhs as diesel::expression::Expression>::SqlType, lhs, rhs>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod range_merge_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct range_merge<R1, R2, lhs, rhs> {
        pub(in super) lhs: lhs,
        pub(in super) rhs: rhs,
        pub(in super) R1: ::core::marker::PhantomData<R1>,
        pub(in super) R2: ::core::marker::PhantomData<R2>,
    }
    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<R1, R2, lhs, rhs, __Rhs> ::core::ops::Add<__Rhs> for
                range_merge<R1, R2, lhs, rhs> 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<R1, R2, lhs, rhs, __Rhs> ::core::ops::Sub<__Rhs> for
                range_merge<R1, R2, lhs, rhs> 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<R1, R2, lhs, rhs, __Rhs> ::core::ops::Mul<__Rhs> for
                range_merge<R1, R2, lhs, rhs> 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<R1, R2, lhs, rhs, __Rhs> ::core::ops::Div<__Rhs> for
                range_merge<R1, R2, lhs, rhs> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R1: ::core::fmt::Debug, R2: ::core::fmt::Debug,
        lhs: ::core::fmt::Debug, rhs: ::core::fmt::Debug> ::core::fmt::Debug
        for range_merge<R1, R2, lhs, rhs> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "range_merge", "lhs", &self.lhs, "rhs", &self.rhs, "R1",
                &self.R1, "R2", &&self.R2)
        }
    }
    #[automatically_derived]
    impl<R1: ::core::clone::Clone, R2: ::core::clone::Clone,
        lhs: ::core::clone::Clone, rhs: ::core::clone::Clone>
        ::core::clone::Clone for range_merge<R1, R2, lhs, rhs> {
        #[inline]
        fn clone(&self) -> range_merge<R1, R2, lhs, rhs> {
            range_merge {
                lhs: ::core::clone::Clone::clone(&self.lhs),
                rhs: ::core::clone::Clone::clone(&self.rhs),
                R1: ::core::clone::Clone::clone(&self.R1),
                R2: ::core::clone::Clone::clone(&self.R2),
            }
        }
    }
    #[automatically_derived]
    impl<R1: ::core::marker::Copy, R2: ::core::marker::Copy,
        lhs: ::core::marker::Copy, rhs: ::core::marker::Copy>
        ::core::marker::Copy for range_merge<R1, R2, lhs, rhs> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R1: diesel::query_builder::QueryId,
                R2: diesel::query_builder::QueryId,
                lhs: diesel::query_builder::QueryId,
                rhs: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                range_merge<R1, R2, lhs, rhs> {
                type QueryId =
                    range_merge<<R1 as diesel::query_builder::QueryId>::QueryId,
                    <R2 as diesel::query_builder::QueryId>::QueryId,
                    <lhs as diesel::query_builder::QueryId>::QueryId,
                    <rhs as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <R2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <lhs as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <rhs as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <R1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <R2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <lhs as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <rhs as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`range_merge()`](fn@range_merge)"]
    pub type HelperType<R1, R2, lhs, rhs> =
        range_merge<R1, R2, <lhs as AsExpression<R1>>::Expression,
        <rhs as AsExpression<R2>>::Expression>;
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs> Expression for
        range_merge<R1, R2, lhs, rhs> where (lhs, rhs): Expression {
        type SqlType = R2::Out;
    }
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        range_merge<R1, R2, lhs, rhs> where
        lhs: SelectableExpression<__DieselInternal>,
        rhs: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        range_merge<R1, R2, lhs, rhs> where
        lhs: AppearsOnTable<__DieselInternal>,
        rhs: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        range_merge<R1, R2, lhs, rhs> where
        __DieselInternal: diesel::backend::Backend,
        lhs: QueryFragment<__DieselInternal>,
        rhs: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "range_merge";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lhs.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lhs.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.rhs.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.rhs.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs>
        QueryFragment<crate::pg::Pg> for range_merge<R1, R2, lhs, rhs> where
        lhs: QueryFragment<crate::pg::Pg>, rhs: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lhs, rhs>(lhs, rhs);
    const _: () =
        {
            use diesel;
            impl<lhs, rhs, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lhs, rhs> where
                lhs: diesel::expression::ValidGrouping<__GroupByClause>,
                rhs: diesel::expression::ValidGrouping<__GroupByClause>,
                <lhs as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<rhs
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<lhs as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<rhs as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<R1: RangeOrNullableRange + SingleValue,
        R2: RangeOrNullableRange<Inner = R1::Inner> + SingleValue +
        CombinedNullableValue<R1, Range<R1::Inner>>, lhs, rhs,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        range_merge<R1, R2, lhs, rhs> where
        __Derived<lhs, rhs>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<lhs, rhs> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns the smallest range which includes all ranges in the multirange"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " # use diesel::pg::sql_types::{Range, Multirange};"]
#[doc = " # use diesel::dsl::multirange_merge;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let int = diesel::select(multirange_merge::<Multirange<Integer>, _>(vec!["]
#[doc = "     1..3,"]
#[doc = "     7..10,"]
#[doc = " ]))"]
#[doc = " .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;"]
#[doc = " assert_eq!((Bound::Included(1), Bound::Excluded(10)), int);"]
#[doc = ""]
#[doc =
" let int = diesel::select(multirange_merge::<Nullable<Multirange<Integer>>, _>("]
#[doc = "     None::<Vec<std::ops::Range<i32>>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;"]
#[doc = " assert_eq!(None, int);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn multirange_merge<R: MultirangeOrNullableMultirange + SingleValue,
    multirange>(multirange: multirange) -> multirange_merge<R, multirange>
    where multirange: diesel::expression::AsExpression<R> {
    multirange_merge_utils::multirange_merge {
        multirange: multirange.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`multirange_merge()`](fn@multirange_merge)"]
pub type multirange_merge<R, multirange> =
    multirange_merge_utils::multirange_merge<R,
    <multirange as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __multirange_merge_return_type {
    #[doc =
    "Return type of the [`multirange_merge()`](fn@super::multirange_merge) SQL function."]
    pub type multirange_merge<multirange> =
        super::multirange_merge<<multirange as
        diesel::expression::Expression>::SqlType, multirange>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod multirange_merge_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct multirange_merge<R, multirange> {
        pub(in super) multirange: multirange,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, multirange, __Rhs> ::core::ops::Add<__Rhs> for
                multirange_merge<R, multirange> 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<R, multirange, __Rhs> ::core::ops::Sub<__Rhs> for
                multirange_merge<R, multirange> 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<R, multirange, __Rhs> ::core::ops::Mul<__Rhs> for
                multirange_merge<R, multirange> 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<R, multirange, __Rhs> ::core::ops::Div<__Rhs> for
                multirange_merge<R, multirange> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, multirange: ::core::fmt::Debug>
        ::core::fmt::Debug for multirange_merge<R, multirange> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "multirange_merge", "multirange", &self.multirange, "R",
                &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, multirange: ::core::clone::Clone>
        ::core::clone::Clone for multirange_merge<R, multirange> {
        #[inline]
        fn clone(&self) -> multirange_merge<R, multirange> {
            multirange_merge {
                multirange: ::core::clone::Clone::clone(&self.multirange),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, multirange: ::core::marker::Copy>
        ::core::marker::Copy for multirange_merge<R, multirange> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                multirange: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                multirange_merge<R, multirange> {
                type QueryId =
                    multirange_merge<<R as
                    diesel::query_builder::QueryId>::QueryId,
                    <multirange as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <multirange as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <multirange as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`multirange_merge()`](fn@multirange_merge)"]
    pub type HelperType<R, multirange> =
        multirange_merge<R, <multirange as AsExpression<R>>::Expression>;
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange>
        Expression for multirange_merge<R, multirange> where
        (multirange): Expression {
        type SqlType = R::Range;
    }
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        multirange_merge<R, multirange> where
        multirange: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        multirange_merge<R, multirange> where
        multirange: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        multirange_merge<R, multirange> where
        __DieselInternal: diesel::backend::Backend,
        multirange: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "range_merge";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.multirange.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.multirange.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange>
        QueryFragment<crate::pg::Pg> for multirange_merge<R, multirange> where
        multirange: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<multirange>(multirange);
    const _: () =
        {
            use diesel;
            impl<multirange, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<multirange> where
                multirange: diesel::expression::ValidGrouping<__GroupByClause>
                {
                type IsAggregate =
                    <multirange as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: MultirangeOrNullableMultirange + SingleValue, multirange,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        multirange_merge<R, multirange> where
        __Derived<multirange>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<multirange> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of integer"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Int4range,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions INT4RANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " use diesel::dsl::int4range;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(int4range(Some(3), Some(5), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(int4range(None, Some(2), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc = "     .load::<(Bound<i32>, Bound<i32>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(3), Bound::Excluded(6)), // Postgres cast this internally"]
#[doc = "          (Bound::Unbounded, Bound::Excluded(2)),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn int4range<lower, upper,
    bound>(lower: lower, upper: upper, bound: bound)
    -> int4range<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<Integer>>,
    upper: diesel::expression::AsExpression<Nullable<Integer>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    int4range_utils::int4range {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`int4range()`](fn@int4range)"]
pub type int4range<lower, upper, bound> =
    int4range_utils::int4range<<lower as
    diesel::expression::AsExpression<Nullable<Integer>>>::Expression,
    <upper as
    diesel::expression::AsExpression<Nullable<Integer>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __int4range_return_type {
    #[doc =
    "Return type of the [`int4range()`](fn@super::int4range) SQL function."]
    pub type int4range<lower, upper, bound> =
        super::int4range<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod int4range_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct int4range<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                int4range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                int4range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                int4range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                int4range<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        int4range<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "int4range",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        int4range<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> int4range<lower, upper, bound> {
            int4range {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        int4range<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                int4range<lower, upper, bound> {
                type QueryId =
                    int4range<<lower as
                    diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`int4range()`](fn@int4range)"]
    pub type HelperType<lower, upper, bound> =
        int4range<<lower as AsExpression<Nullable<Integer>>>::Expression,
        <upper as AsExpression<Nullable<Integer>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for int4range<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Int4range;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        int4range<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for int4range<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for int4range<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "int4range";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        int4range<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for int4range<lower, upper, bound>
        where __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of big ints"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Int8range,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions INT8RANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " use diesel::dsl::int8range;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(int8range(Some(3), Some(5), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(int8range(None, Some(2), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc = "     .load::<(Bound<i64>, Bound<i64>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(3), Bound::Excluded(6)), // Postgres cast this internally"]
#[doc = "          (Bound::Unbounded, Bound::Excluded(2)),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn int8range<lower, upper,
    bound>(lower: lower, upper: upper, bound: bound)
    -> int8range<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<BigInt>>,
    upper: diesel::expression::AsExpression<Nullable<BigInt>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    int8range_utils::int8range {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`int8range()`](fn@int8range)"]
pub type int8range<lower, upper, bound> =
    int8range_utils::int8range<<lower as
    diesel::expression::AsExpression<Nullable<BigInt>>>::Expression,
    <upper as diesel::expression::AsExpression<Nullable<BigInt>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __int8range_return_type {
    #[doc =
    "Return type of the [`int8range()`](fn@super::int8range) SQL function."]
    pub type int8range<lower, upper, bound> =
        super::int8range<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod int8range_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct int8range<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                int8range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                int8range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                int8range<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                int8range<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        int8range<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "int8range",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        int8range<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> int8range<lower, upper, bound> {
            int8range {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        int8range<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                int8range<lower, upper, bound> {
                type QueryId =
                    int8range<<lower as
                    diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`int8range()`](fn@int8range)"]
    pub type HelperType<lower, upper, bound> =
        int8range<<lower as AsExpression<Nullable<BigInt>>>::Expression,
        <upper as AsExpression<Nullable<BigInt>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for int8range<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Int8range;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        int8range<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for int8range<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for int8range<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "int8range";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        int8range<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for int8range<lower, upper, bound>
        where __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of numeric values"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Numrange,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"numeric\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"numeric\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions NUMRANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " # use bigdecimal::BigDecimal;"]
#[doc = " use diesel::dsl::numrange;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(numrange(Some(BigDecimal::from(3)), Some(BigDecimal::from(5)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(numrange(None, Some(BigDecimal::from(2)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc = "     .load::<(Bound<BigDecimal>, Bound<BigDecimal>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(BigDecimal::from(3)), Bound::Included(BigDecimal::from(5))),"]
#[doc = "          (Bound::Unbounded, Bound::Excluded(BigDecimal::from(2))),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn numrange<lower, upper, bound>(lower: lower, upper: upper, bound: bound)
    -> numrange<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<Numeric>>,
    upper: diesel::expression::AsExpression<Nullable<Numeric>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    numrange_utils::numrange {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`numrange()`](fn@numrange)"]
pub type numrange<lower, upper, bound> =
    numrange_utils::numrange<<lower as
    diesel::expression::AsExpression<Nullable<Numeric>>>::Expression,
    <upper as
    diesel::expression::AsExpression<Nullable<Numeric>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __numrange_return_type {
    #[doc =
    "Return type of the [`numrange()`](fn@super::numrange) SQL function."]
    pub type numrange<lower, upper, bound> =
        super::numrange<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod numrange_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct numrange<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                numrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                numrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                numrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                numrange<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        numrange<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "numrange",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        numrange<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> numrange<lower, upper, bound> {
            numrange {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        numrange<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                numrange<lower, upper, bound> {
                type QueryId =
                    numrange<<lower as diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`numrange()`](fn@numrange)"]
    pub type HelperType<lower, upper, bound> =
        numrange<<lower as AsExpression<Nullable<Numeric>>>::Expression,
        <upper as AsExpression<Nullable<Numeric>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for numrange<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Numrange;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        numrange<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for numrange<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for numrange<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "numrange";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        numrange<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for numrange<lower, upper, bound>
        where __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of timestamps without timezone"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Tsrange,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"time\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"time\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions TSRANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " use diesel::dsl::tsrange;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = " use time::{PrimitiveDateTime, macros::datetime};"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(tsrange(Some(datetime!(2020-01-01 0:00)), Some(datetime!(2021-01-01 0:00)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(tsrange(None, Some(datetime!(2020-01-01 0:00)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc =
"     .load::<(Bound<PrimitiveDateTime>, Bound<PrimitiveDateTime>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(datetime!(2020-01-01 0:00)), Bound::Included(datetime!(2021-01-01 0:00))),"]
#[doc =
"          (Bound::Unbounded, Bound::Excluded(datetime!(2020-01-01 0:00))),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn tsrange<lower, upper, bound>(lower: lower, upper: upper, bound: bound)
    -> tsrange<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<Timestamp>>,
    upper: diesel::expression::AsExpression<Nullable<Timestamp>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    tsrange_utils::tsrange {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`tsrange()`](fn@tsrange)"]
pub type tsrange<lower, upper, bound> =
    tsrange_utils::tsrange<<lower as
    diesel::expression::AsExpression<Nullable<Timestamp>>>::Expression,
    <upper as
    diesel::expression::AsExpression<Nullable<Timestamp>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __tsrange_return_type {
    #[doc =
    "Return type of the [`tsrange()`](fn@super::tsrange) SQL function."]
    pub type tsrange<lower, upper, bound> =
        super::tsrange<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod tsrange_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct tsrange<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                tsrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                tsrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                tsrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                tsrange<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        tsrange<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "tsrange",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        tsrange<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> tsrange<lower, upper, bound> {
            tsrange {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        tsrange<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                tsrange<lower, upper, bound> {
                type QueryId =
                    tsrange<<lower as diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`tsrange()`](fn@tsrange)"]
    pub type HelperType<lower, upper, bound> =
        tsrange<<lower as AsExpression<Nullable<Timestamp>>>::Expression,
        <upper as AsExpression<Nullable<Timestamp>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for tsrange<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Tsrange;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        tsrange<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for tsrange<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for tsrange<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "tsrange";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        tsrange<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for tsrange<lower, upper, bound> where
        __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of timestamps with timezone"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Tstzrange,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"time\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"time\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions TSTZRANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " use diesel::dsl::tstzrange;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = " use time::{OffsetDateTime, macros::datetime};"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(tstzrange(Some(datetime!(2020-01-01 0:00 UTC)), Some(datetime!(2021-01-01 0:00 -3)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(tstzrange(None, Some(datetime!(2020-01-01 0:00 +2)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc =
"     .load::<(Bound<OffsetDateTime>, Bound<OffsetDateTime>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(datetime!(2020-01-01 0:00 UTC)), Bound::Included(datetime!(2021-01-01 0:00 -3))),"]
#[doc =
"          (Bound::Unbounded, Bound::Excluded(datetime!(2020-01-01 0:00 +2))),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn tstzrange<lower, upper,
    bound>(lower: lower, upper: upper, bound: bound)
    -> tstzrange<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<Timestamptz>>,
    upper: diesel::expression::AsExpression<Nullable<Timestamptz>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    tstzrange_utils::tstzrange {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`tstzrange()`](fn@tstzrange)"]
pub type tstzrange<lower, upper, bound> =
    tstzrange_utils::tstzrange<<lower as
    diesel::expression::AsExpression<Nullable<Timestamptz>>>::Expression,
    <upper as
    diesel::expression::AsExpression<Nullable<Timestamptz>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __tstzrange_return_type {
    #[doc =
    "Return type of the [`tstzrange()`](fn@super::tstzrange) SQL function."]
    pub type tstzrange<lower, upper, bound> =
        super::tstzrange<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod tstzrange_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct tstzrange<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                tstzrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                tstzrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                tstzrange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                tstzrange<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        tstzrange<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "tstzrange",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        tstzrange<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> tstzrange<lower, upper, bound> {
            tstzrange {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        tstzrange<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                tstzrange<lower, upper, bound> {
                type QueryId =
                    tstzrange<<lower as
                    diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`tstzrange()`](fn@tstzrange)"]
    pub type HelperType<lower, upper, bound> =
        tstzrange<<lower as AsExpression<Nullable<Timestamptz>>>::Expression,
        <upper as AsExpression<Nullable<Timestamptz>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for tstzrange<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Tstzrange;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        tstzrange<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for tstzrange<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for tstzrange<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "tstzrange";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        tstzrange<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for tstzrange<lower, upper, bound>
        where __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns range of dates"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # table! {"]
#[doc = " #     posts {"]
#[doc = " #         id -> Integer,"]
#[doc = " #         versions -> Daterange,"]
#[doc = " #     }"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"time\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"time\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use self::posts::dsl::*;"]
#[doc = " #     use std::collections::Bound;"]
#[doc = " #     let conn = &mut establish_connection();"]
#[doc =
" #     diesel::sql_query(\"DROP TABLE IF EXISTS posts\").execute(conn).unwrap();"]
#[doc =
" #     diesel::sql_query(\"CREATE TABLE posts (id SERIAL PRIMARY KEY, versions DATERANGE NOT NULL)\").execute(conn).unwrap();"]
#[doc = " #"]
#[doc = " use diesel::dsl::daterange;"]
#[doc = " use diesel::pg::sql_types::RangeBound;"]
#[doc = " use time::{Date, macros::date};"]
#[doc = ""]
#[doc = " diesel::insert_into(posts)"]
#[doc = "     .values(&["]
#[doc =
"        versions.eq(daterange(Some(date!(2020-01-01)), Some(date!(2021-01-01)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),"]
#[doc =
"        versions.eq(daterange(None, Some(date!(2020-01-01)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),"]
#[doc = "     ]).execute(conn)?;"]
#[doc = ""]
#[doc = " let cool_posts = posts.select(versions)"]
#[doc = "     .load::<(Bound<Date>, Bound<Date>)>(conn)?;"]
#[doc = " assert_eq!(vec!["]
#[doc =
"          (Bound::Included(date!(2020-01-01)), Bound::Excluded(date!(2021-01-02))),"]
#[doc = "          (Bound::Unbounded, Bound::Excluded(date!(2020-01-01))),"]
#[doc = "      ], cool_posts);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn daterange<lower, upper,
    bound>(lower: lower, upper: upper, bound: bound)
    -> daterange<lower, upper, bound> where
    lower: diesel::expression::AsExpression<Nullable<Date>>,
    upper: diesel::expression::AsExpression<Nullable<Date>>,
    bound: diesel::expression::AsExpression<RangeBoundEnum> {
    daterange_utils::daterange {
        lower: lower.as_expression(),
        upper: upper.as_expression(),
        bound: bound.as_expression(),
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`daterange()`](fn@daterange)"]
pub type daterange<lower, upper, bound> =
    daterange_utils::daterange<<lower as
    diesel::expression::AsExpression<Nullable<Date>>>::Expression,
    <upper as diesel::expression::AsExpression<Nullable<Date>>>::Expression,
    <bound as diesel::expression::AsExpression<RangeBoundEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __daterange_return_type {
    #[doc =
    "Return type of the [`daterange()`](fn@super::daterange) SQL function."]
    pub type daterange<lower, upper, bound> =
        super::daterange<lower, upper, bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod daterange_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct daterange<lower, upper, bound> {
        pub(in super) lower: lower,
        pub(in super) upper: upper,
        pub(in super) bound: bound,
    }
    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<lower, upper, bound, __Rhs> ::core::ops::Add<__Rhs> for
                daterange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Sub<__Rhs> for
                daterange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Mul<__Rhs> for
                daterange<lower, upper, bound> 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<lower, upper, bound, __Rhs> ::core::ops::Div<__Rhs> for
                daterange<lower, upper, bound> 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())
                }
            }
        };
    #[automatically_derived]
    impl<lower: ::core::fmt::Debug, upper: ::core::fmt::Debug,
        bound: ::core::fmt::Debug> ::core::fmt::Debug for
        daterange<lower, upper, bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "daterange",
                "lower", &self.lower, "upper", &self.upper, "bound",
                &&self.bound)
        }
    }
    #[automatically_derived]
    impl<lower: ::core::clone::Clone, upper: ::core::clone::Clone,
        bound: ::core::clone::Clone> ::core::clone::Clone for
        daterange<lower, upper, bound> {
        #[inline]
        fn clone(&self) -> daterange<lower, upper, bound> {
            daterange {
                lower: ::core::clone::Clone::clone(&self.lower),
                upper: ::core::clone::Clone::clone(&self.upper),
                bound: ::core::clone::Clone::clone(&self.bound),
            }
        }
    }
    #[automatically_derived]
    impl<lower: ::core::marker::Copy, upper: ::core::marker::Copy,
        bound: ::core::marker::Copy> ::core::marker::Copy for
        daterange<lower, upper, bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<lower: diesel::query_builder::QueryId,
                upper: diesel::query_builder::QueryId,
                bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                daterange<lower, upper, bound> {
                type QueryId =
                    daterange<<lower as
                    diesel::query_builder::QueryId>::QueryId,
                    <upper as diesel::query_builder::QueryId>::QueryId,
                    <bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <upper as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <lower as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <upper as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`daterange()`](fn@daterange)"]
    pub type HelperType<lower, upper, bound> =
        daterange<<lower as AsExpression<Nullable<Date>>>::Expression,
        <upper as AsExpression<Nullable<Date>>>::Expression,
        <bound as AsExpression<RangeBoundEnum>>::Expression>;
    impl<lower, upper, bound> Expression for daterange<lower, upper, bound>
        where (lower, upper, bound): Expression {
        type SqlType = Daterange;
    }
    impl<lower, upper, bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        daterange<lower, upper, bound> where
        lower: SelectableExpression<__DieselInternal>,
        upper: SelectableExpression<__DieselInternal>,
        bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<lower, upper, bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for daterange<lower, upper, bound>
        where lower: AppearsOnTable<__DieselInternal>,
        upper: AppearsOnTable<__DieselInternal>,
        bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<lower, upper, bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for daterange<lower, upper, bound>
        where __DieselInternal: diesel::backend::Backend,
        lower: QueryFragment<__DieselInternal>,
        upper: QueryFragment<__DieselInternal>,
        bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "daterange";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.lower.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.upper.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.upper.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<lower, upper, bound> QueryFragment<crate::pg::Pg> for
        daterange<lower, upper, bound> where
        lower: QueryFragment<crate::pg::Pg>,
        upper: QueryFragment<crate::pg::Pg>,
        bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<lower, upper, bound>(lower, upper, bound);
    const _: () =
        {
            use diesel;
            impl<lower, upper, bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<lower, upper, bound> where
                lower: diesel::expression::ValidGrouping<__GroupByClause>,
                upper: diesel::expression::ValidGrouping<__GroupByClause>,
                bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<upper
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<lower as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<upper as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<lower as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<upper as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<lower, upper, bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for daterange<lower, upper, bound>
        where __Derived<lower, upper, bound>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<lower, upper, bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Append an element to the end of an array"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_append;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let ints = diesel::select(array_append::<Array<_>, Integer, _, _>(vec![1, 2], 3))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1, 2, 3], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_append::<Array<_>, Nullable<Integer>, _, _>("]
#[doc = "     vec![Some(1), Some(2)],"]
#[doc = "     None::<i32>,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(1), Some(2), None], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_append::<Nullable<Array<_>>, Integer, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     3,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![3], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_append::<Nullable<Array<_>>, Nullable<Integer>, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     None::<i32>,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![None], ints);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_append<Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
    T: SingleValue, a, e>(a: a, e: e) -> array_append<Arr, T, a, e> where
    a: diesel::expression::AsExpression<Arr>,
    e: diesel::expression::AsExpression<T> {
    array_append_utils::array_append {
        a: a.as_expression(),
        e: e.as_expression(),
        Arr: ::core::marker::PhantomData,
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_append()`](fn@array_append)"]
pub type array_append<Arr, T, a, e> =
    array_append_utils::array_append<Arr, T,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <e as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_append_return_type {
    #[doc =
    "Return type of the [`array_append()`](fn@super::array_append) SQL function."]
    pub type array_append<a, e> =
        super::array_append<<a as diesel::expression::Expression>::SqlType,
        <e as diesel::expression::Expression>::SqlType, a, e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_append_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_append<Arr, T, a, e> {
        pub(in super) a: a,
        pub(in super) e: e,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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<Arr, T, a, e, __Rhs> ::core::ops::Add<__Rhs> for
                array_append<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Sub<__Rhs> for
                array_append<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Mul<__Rhs> for
                array_append<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Div<__Rhs> for
                array_append<Arr, T, a, e> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, T: ::core::fmt::Debug,
        a: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        array_append<Arr, T, a, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_append", "a", &self.a, "e", &self.e, "Arr", &self.Arr,
                "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, T: ::core::clone::Clone,
        a: ::core::clone::Clone, e: ::core::clone::Clone> ::core::clone::Clone
        for array_append<Arr, T, a, e> {
        #[inline]
        fn clone(&self) -> array_append<Arr, T, a, e> {
            array_append {
                a: ::core::clone::Clone::clone(&self.a),
                e: ::core::clone::Clone::clone(&self.e),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, T: ::core::marker::Copy,
        a: ::core::marker::Copy, e: ::core::marker::Copy> ::core::marker::Copy
        for array_append<Arr, T, a, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                T: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_append<Arr, T, a, e>
                {
                type QueryId =
                    array_append<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <T as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_append()`](fn@array_append)"]
    pub type HelperType<Arr, T, a, e> =
        array_append<Arr, T, <a as AsExpression<Arr>>::Expression,
        <e as AsExpression<T>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e> Expression for array_append<Arr, T, a, e> where
        (a, e): Expression {
        type SqlType = Array<T>;
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> SelectableExpression<__DieselInternal> for
        array_append<Arr, T, a, e> where
        a: SelectableExpression<__DieselInternal>,
        e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_append<Arr, T, a, e> where a: AppearsOnTable<__DieselInternal>,
        e: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> FunctionFragment<__DieselInternal> for
        array_append<Arr, T, a, e> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, e: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "array_append";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e> QueryFragment<crate::pg::Pg> for array_append<Arr, T, a, e>
        where a: QueryFragment<crate::pg::Pg>, e: QueryFragment<crate::pg::Pg>
        {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, e>(a, e);
    const _: () =
        {
            use diesel;
            impl<a, e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, e> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                e: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<e
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> ValidGrouping<__DieselInternal> for
        array_append<Arr, T, a, e> where
        __Derived<a, e>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Replace all occurrences of an element in an array with a given element"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_replace;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let ints = diesel::select(array_replace::<Array<_>, Integer, _, _, _>("]
#[doc = "     vec![1, 2, 5, 4],"]
#[doc = "     5,"]
#[doc = "     3,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1, 2, 3, 4], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_replace::<Array<_>, Nullable<Integer>, _, _, _>("]
#[doc = "     vec![Some(1), Some(2), Some(3)],"]
#[doc = "     Some(3),"]
#[doc = "     None::<i32>,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(1), Some(2), None], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_replace::<Nullable<Array<_>>, Integer, _, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     1,"]
#[doc = "     2,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = ""]
#[doc = " let ints = diesel::select(array_replace::<"]
#[doc = "     Nullable<Array<_>>,"]
#[doc = "     Nullable<Integer>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >(None::<Vec<i32>>, None::<i32>, Some(1)))"]
#[doc = " .get_result::<Option<Vec<Option<i32>>>>(connection)?;"]
#[doc = " assert_eq!(None, ints);"]
#[doc = " #    Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_replace<Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
    T: SingleValue, a, e, r>(a: a, e: e, r: r)
    -> array_replace<Arr, T, a, e, r> where
    a: diesel::expression::AsExpression<Arr>,
    e: diesel::expression::AsExpression<T>,
    r: diesel::expression::AsExpression<T> {
    array_replace_utils::array_replace {
        a: a.as_expression(),
        e: e.as_expression(),
        r: r.as_expression(),
        Arr: ::core::marker::PhantomData,
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_replace()`](fn@array_replace)"]
pub type array_replace<Arr, T, a, e, r> =
    array_replace_utils::array_replace<Arr, T,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <e as diesel::expression::AsExpression<T>>::Expression,
    <r as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_replace_return_type {
    #[doc =
    "Return type of the [`array_replace()`](fn@super::array_replace) SQL function."]
    pub type array_replace<a, e, r> =
        super::array_replace<<a as diesel::expression::Expression>::SqlType,
        <e as diesel::expression::Expression>::SqlType, a, e, r>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_replace_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_replace<Arr, T, a, e, r> {
        pub(in super) a: a,
        pub(in super) e: e,
        pub(in super) r: r,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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<Arr, T, a, e, r, __Rhs> ::core::ops::Add<__Rhs> for
                array_replace<Arr, T, a, e, r> 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<Arr, T, a, e, r, __Rhs> ::core::ops::Sub<__Rhs> for
                array_replace<Arr, T, a, e, r> 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<Arr, T, a, e, r, __Rhs> ::core::ops::Mul<__Rhs> for
                array_replace<Arr, T, a, e, r> 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<Arr, T, a, e, r, __Rhs> ::core::ops::Div<__Rhs> for
                array_replace<Arr, T, a, e, r> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, T: ::core::fmt::Debug,
        a: ::core::fmt::Debug, e: ::core::fmt::Debug, r: ::core::fmt::Debug>
        ::core::fmt::Debug for array_replace<Arr, T, a, e, r> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field5_finish(f,
                "array_replace", "a", &self.a, "e", &self.e, "r", &self.r,
                "Arr", &self.Arr, "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, T: ::core::clone::Clone,
        a: ::core::clone::Clone, e: ::core::clone::Clone,
        r: ::core::clone::Clone> ::core::clone::Clone for
        array_replace<Arr, T, a, e, r> {
        #[inline]
        fn clone(&self) -> array_replace<Arr, T, a, e, r> {
            array_replace {
                a: ::core::clone::Clone::clone(&self.a),
                e: ::core::clone::Clone::clone(&self.e),
                r: ::core::clone::Clone::clone(&self.r),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, T: ::core::marker::Copy,
        a: ::core::marker::Copy, e: ::core::marker::Copy,
        r: ::core::marker::Copy> ::core::marker::Copy for
        array_replace<Arr, T, a, e, r> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                T: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId,
                r: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_replace<Arr, T, a, e, r> {
                type QueryId =
                    array_replace<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <T as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId,
                    <r as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <r as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        || <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <r as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_replace()`](fn@array_replace)"]
    pub type HelperType<Arr, T, a, e, r> =
        array_replace<Arr, T, <a as AsExpression<Arr>>::Expression,
        <e as AsExpression<T>>::Expression,
        <r as AsExpression<T>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r> Expression for array_replace<Arr, T, a, e, r> where
        (a, e, r): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r, __DieselInternal> SelectableExpression<__DieselInternal> for
        array_replace<Arr, T, a, e, r> where
        a: SelectableExpression<__DieselInternal>,
        e: SelectableExpression<__DieselInternal>,
        r: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r, __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_replace<Arr, T, a, e, r> where
        a: AppearsOnTable<__DieselInternal>,
        e: AppearsOnTable<__DieselInternal>,
        r: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r, __DieselInternal> FunctionFragment<__DieselInternal> for
        array_replace<Arr, T, a, e, r> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>,
        e: QueryFragment<__DieselInternal>, r: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "array_replace";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.r.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.r.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r> QueryFragment<crate::pg::Pg> for
        array_replace<Arr, T, a, e, r> where a: QueryFragment<crate::pg::Pg>,
        e: QueryFragment<crate::pg::Pg>, r: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, e, r>(a, e, r);
    const _: () =
        {
            use diesel;
            impl<a, e, r, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, e, r> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                e: diesel::expression::ValidGrouping<__GroupByClause>,
                r: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<e
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<e as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<r
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<r as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, r, __DieselInternal> ValidGrouping<__DieselInternal> for
        array_replace<Arr, T, a, e, r> where
        __Derived<a, e, r>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, e, r> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns a text representation of the array\'s dimensions"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_dims;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let dims = diesel::select(array_dims::<Array<Integer>,_>(vec![1,2]))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = " assert!(String::from(\"[1:2]\").eq(&dims));"]
#[doc = ""]
#[doc =
" let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>,Some(2)]))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = " assert!(String::from(\"[1:2]\").eq(&dims));"]
#[doc = ""]
#[doc =
" let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>]))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = " assert!(String::from(\"[1:1]\").eq(&dims));"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_dims<Arr: ArrayOrNullableArray + SingleValue, arr>(arr: arr)
    -> array_dims<Arr, arr> where arr: diesel::expression::AsExpression<Arr> {
    array_dims_utils::array_dims {
        arr: arr.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_dims()`](fn@array_dims)"]
pub type array_dims<Arr, arr> =
    array_dims_utils::array_dims<Arr,
    <arr as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_dims_return_type {
    #[doc =
    "Return type of the [`array_dims()`](fn@super::array_dims) SQL function."]
    pub type array_dims<arr> =
        super::array_dims<<arr as diesel::expression::Expression>::SqlType,
        arr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_dims_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_dims<Arr, arr> {
        pub(in super) arr: arr,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, arr, __Rhs> ::core::ops::Add<__Rhs> for
                array_dims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Sub<__Rhs> for
                array_dims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Mul<__Rhs> for
                array_dims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Div<__Rhs> for
                array_dims<Arr, arr> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, arr: ::core::fmt::Debug> ::core::fmt::Debug
        for array_dims<Arr, arr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "array_dims", "arr", &self.arr, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, arr: ::core::clone::Clone>
        ::core::clone::Clone for array_dims<Arr, arr> {
        #[inline]
        fn clone(&self) -> array_dims<Arr, arr> {
            array_dims {
                arr: ::core::clone::Clone::clone(&self.arr),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, arr: ::core::marker::Copy>
        ::core::marker::Copy for array_dims<Arr, arr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                arr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_dims<Arr, arr> {
                type QueryId =
                    array_dims<<Arr as diesel::query_builder::QueryId>::QueryId,
                    <arr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_dims()`](fn@array_dims)"]
    pub type HelperType<Arr, arr> =
        array_dims<Arr, <arr as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, arr> Expression for
        array_dims<Arr, arr> where (arr): Expression {
        type SqlType = Text;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, arr, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_dims<Arr, arr> where
        arr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, arr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_dims<Arr, arr> where
        arr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, arr, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_dims<Arr, arr> where
        __DieselInternal: diesel::backend::Backend,
        arr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_dims";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.arr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.arr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, arr>
        QueryFragment<crate::pg::Pg> for array_dims<Arr, arr> where
        arr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<arr>(arr);
    const _: () =
        {
            use diesel;
            impl<arr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<arr> where
                arr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <arr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, arr, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_dims<Arr, arr> where
        __Derived<arr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<arr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Prepends an element to the beginning of an array"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_prepend;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let ints = diesel::select(array_prepend::<Integer, Array<_>, _, _>(3, vec![1, 2]))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![3, 1, 2], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_prepend::<Nullable<Integer>, Array<_>, _, _>("]
#[doc = "     None::<i32>,"]
#[doc = "     vec![Some(1), Some(2)],"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![None, Some(1), Some(2)], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_prepend::<Integer, Nullable<Array<_>>, _, _>("]
#[doc = "     3,"]
#[doc = "     None::<Vec<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![3], ints);"]
#[doc = ""]
#[doc = " let ints = diesel::select("]
#[doc =
"     array_prepend::<Nullable<Integer>, Nullable<Array<_>>, _, _>(None::<i32>, None::<Vec<i32>>),"]
#[doc = " )"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![None], ints);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_prepend<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> +
    SingleValue, e, a>(e: e, a: a) -> array_prepend<T, Arr, e, a> where
    e: diesel::expression::AsExpression<T>,
    a: diesel::expression::AsExpression<Arr> {
    array_prepend_utils::array_prepend {
        e: e.as_expression(),
        a: a.as_expression(),
        T: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_prepend()`](fn@array_prepend)"]
pub type array_prepend<T, Arr, e, a> =
    array_prepend_utils::array_prepend<T, Arr,
    <e as diesel::expression::AsExpression<T>>::Expression,
    <a as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_prepend_return_type {
    #[doc =
    "Return type of the [`array_prepend()`](fn@super::array_prepend) SQL function."]
    pub type array_prepend<e, a> =
        super::array_prepend<<e as diesel::expression::Expression>::SqlType,
        <a as diesel::expression::Expression>::SqlType, e, a>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_prepend_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_prepend<T, Arr, e, a> {
        pub(in super) e: e,
        pub(in super) a: a,
        pub(in super) T: ::core::marker::PhantomData<T>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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, Arr, e, a, __Rhs> ::core::ops::Add<__Rhs> for
                array_prepend<T, Arr, e, a> 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, Arr, e, a, __Rhs> ::core::ops::Sub<__Rhs> for
                array_prepend<T, Arr, e, a> 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, Arr, e, a, __Rhs> ::core::ops::Mul<__Rhs> for
                array_prepend<T, Arr, e, a> 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, Arr, e, a, __Rhs> ::core::ops::Div<__Rhs> for
                array_prepend<T, Arr, e, a> 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())
                }
            }
        };
    #[automatically_derived]
    impl<T: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        e: ::core::fmt::Debug, a: ::core::fmt::Debug> ::core::fmt::Debug for
        array_prepend<T, Arr, e, a> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_prepend", "e", &self.e, "a", &self.a, "T", &self.T,
                "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<T: ::core::clone::Clone, Arr: ::core::clone::Clone,
        e: ::core::clone::Clone, a: ::core::clone::Clone> ::core::clone::Clone
        for array_prepend<T, Arr, e, a> {
        #[inline]
        fn clone(&self) -> array_prepend<T, Arr, e, a> {
            array_prepend {
                e: ::core::clone::Clone::clone(&self.e),
                a: ::core::clone::Clone::clone(&self.a),
                T: ::core::clone::Clone::clone(&self.T),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<T: ::core::marker::Copy, Arr: ::core::marker::Copy,
        e: ::core::marker::Copy, a: ::core::marker::Copy> ::core::marker::Copy
        for array_prepend<T, Arr, e, a> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<T: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_prepend<T, Arr, e, a>
                {
                type QueryId =
                    array_prepend<<T as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_prepend()`](fn@array_prepend)"]
    pub type HelperType<T, Arr, e, a> =
        array_prepend<T, Arr, <e as AsExpression<T>>::Expression,
        <a as AsExpression<Arr>>::Expression>;
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a> Expression for array_prepend<T, Arr, e, a> where
        (e, a): Expression {
        type SqlType = Array<T>;
    }
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a, __DieselInternal> SelectableExpression<__DieselInternal> for
        array_prepend<T, Arr, e, a> where
        e: SelectableExpression<__DieselInternal>,
        a: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a, __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_prepend<T, Arr, e, a> where e: AppearsOnTable<__DieselInternal>,
        a: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a, __DieselInternal> FunctionFragment<__DieselInternal> for
        array_prepend<T, Arr, e, a> where
        __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal>, a: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "array_prepend";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a> QueryFragment<crate::pg::Pg> for array_prepend<T, Arr, e, a>
        where e: QueryFragment<crate::pg::Pg>, a: QueryFragment<crate::pg::Pg>
        {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e, a>(e, a);
    const _: () =
        {
            use diesel;
            impl<e, a, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e, a> where
                e: diesel::expression::ValidGrouping<__GroupByClause>,
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                <e as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<a
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
        e, a, __DieselInternal> ValidGrouping<__DieselInternal> for
        array_prepend<T, Arr, e, a> where
        __Derived<e, a>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<e, a> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Removes all elements equal to the given value from the array"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_remove;"]
#[doc = " #     use diesel::sql_types::{Nullable, Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let ints = diesel::select(array_remove::<Array<_>, Integer, _, _>(vec![1, 2, 3, 2], 2))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1, 3], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_remove::<Array<_>, Nullable<Integer>, _, _>("]
#[doc = "     vec![None, Some(1), Some(2), None, Some(4)],"]
#[doc = "     None::<i32>,"]
#[doc = " ))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(1), Some(2), Some(4)], ints);"]
#[doc = ""]
#[doc =
" let ints = diesel::select(array_remove::<Nullable<Array<_>>, Nullable<Integer>, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     None::<i32>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<Vec<Option<i32>>>>(connection)?;"]
#[doc = " assert_eq!(None, ints);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_remove<Arr: ArrayOrNullableArray<Inner = T> + SingleValue,
    T: SingleValue, a, e>(a: a, e: e) -> array_remove<Arr, T, a, e> where
    a: diesel::expression::AsExpression<Arr>,
    e: diesel::expression::AsExpression<T> {
    array_remove_utils::array_remove {
        a: a.as_expression(),
        e: e.as_expression(),
        Arr: ::core::marker::PhantomData,
        T: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_remove()`](fn@array_remove)"]
pub type array_remove<Arr, T, a, e> =
    array_remove_utils::array_remove<Arr, T,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <e as diesel::expression::AsExpression<T>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_remove_return_type {
    #[doc =
    "Return type of the [`array_remove()`](fn@super::array_remove) SQL function."]
    pub type array_remove<a, e> =
        super::array_remove<<a as diesel::expression::Expression>::SqlType,
        <e as diesel::expression::Expression>::SqlType, a, e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_remove_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_remove<Arr, T, a, e> {
        pub(in super) a: a,
        pub(in super) e: e,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) T: ::core::marker::PhantomData<T>,
    }
    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<Arr, T, a, e, __Rhs> ::core::ops::Add<__Rhs> for
                array_remove<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Sub<__Rhs> for
                array_remove<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Mul<__Rhs> for
                array_remove<Arr, T, a, e> 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<Arr, T, a, e, __Rhs> ::core::ops::Div<__Rhs> for
                array_remove<Arr, T, a, e> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, T: ::core::fmt::Debug,
        a: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        array_remove<Arr, T, a, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_remove", "a", &self.a, "e", &self.e, "Arr", &self.Arr,
                "T", &&self.T)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, T: ::core::clone::Clone,
        a: ::core::clone::Clone, e: ::core::clone::Clone> ::core::clone::Clone
        for array_remove<Arr, T, a, e> {
        #[inline]
        fn clone(&self) -> array_remove<Arr, T, a, e> {
            array_remove {
                a: ::core::clone::Clone::clone(&self.a),
                e: ::core::clone::Clone::clone(&self.e),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                T: ::core::clone::Clone::clone(&self.T),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, T: ::core::marker::Copy,
        a: ::core::marker::Copy, e: ::core::marker::Copy> ::core::marker::Copy
        for array_remove<Arr, T, a, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                T: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_remove<Arr, T, a, e>
                {
                type QueryId =
                    array_remove<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <T as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <T as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_remove()`](fn@array_remove)"]
    pub type HelperType<Arr, T, a, e> =
        array_remove<Arr, T, <a as AsExpression<Arr>>::Expression,
        <e as AsExpression<T>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e> Expression for array_remove<Arr, T, a, e> where
        (a, e): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> SelectableExpression<__DieselInternal> for
        array_remove<Arr, T, a, e> where
        a: SelectableExpression<__DieselInternal>,
        e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_remove<Arr, T, a, e> where a: AppearsOnTable<__DieselInternal>,
        e: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> FunctionFragment<__DieselInternal> for
        array_remove<Arr, T, a, e> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, e: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "array_remove";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e> QueryFragment<crate::pg::Pg> for array_remove<Arr, T, a, e>
        where a: QueryFragment<crate::pg::Pg>, e: QueryFragment<crate::pg::Pg>
        {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, e>(a, e);
    const _: () =
        {
            use diesel;
            impl<a, e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, e> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                e: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<e
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue,
        a, e, __DieselInternal> ValidGrouping<__DieselInternal> for
        array_remove<Arr, T, a, e> where
        __Derived<a, e>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Converts each array element to its text representation and concatenates those elements"]
#[doc =
" separated by the delimiter string. If `null_string` is provided and is not `NULL`, then `NULL`"]
#[doc =
" array entries are represented by that string; otherwise, they are omitted."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_to_string_with_null_string;"]
#[doc = " #     use diesel::sql_types::{Nullable, Text, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " // Example with `NULL` representation as a string"]
#[doc =
" let result: String = diesel::select(array_to_string_with_null_string::<"]
#[doc = "     Array<Nullable<Text>>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >("]
#[doc = "     vec![Some(\"first\"), None::<&str>, Some(\"third\")],"]
#[doc = "     \",\","]
#[doc = "     \"NULL\","]
#[doc = " ))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"first,NULL,third\");"]
#[doc = ""]
#[doc = " // Example without any `NULL` values"]
#[doc =
" let result: String = diesel::select(array_to_string_with_null_string::<"]
#[doc = "     Array<Nullable<Text>>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >(vec![Some(\"first\"), Some(\"second\")], \",\", \"NULL\"))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"first,second\");"]
#[doc = ""]
#[doc = " // Example with all `NULL` values"]
#[doc =
" let result: String = diesel::select(array_to_string_with_null_string::<"]
#[doc = "     Array<Nullable<Text>>,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = "     _,"]
#[doc = " >(vec![None::<&str>, None::<&str>], \",\", \"NULL\"))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"NULL,NULL\");"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_to_string_with_null_string<Arr: ArrayOrNullableArray +
    SingleValue, array, del, null>(array: array, del: del, null: null)
    -> array_to_string_with_null_string<Arr, array, del, null> where
    array: diesel::expression::AsExpression<Arr>,
    del: diesel::expression::AsExpression<Text>,
    null: diesel::expression::AsExpression<Text> {
    array_to_string_with_null_string_utils::array_to_string_with_null_string {
        array: array.as_expression(),
        del: del.as_expression(),
        null: null.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`array_to_string_with_null_string()`](fn@array_to_string_with_null_string)"]
pub type array_to_string_with_null_string<Arr, array, del, null> =
    array_to_string_with_null_string_utils::array_to_string_with_null_string<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <del as diesel::expression::AsExpression<Text>>::Expression,
    <null as diesel::expression::AsExpression<Text>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_to_string_with_null_string_return_type {
    #[doc =
    "Return type of the [`array_to_string_with_null_string()`](fn@super::array_to_string_with_null_string) SQL function."]
    pub type array_to_string_with_null_string<array, del, null> =
        super::array_to_string_with_null_string<<array as
        diesel::expression::Expression>::SqlType, array, del, null>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_to_string_with_null_string_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_to_string_with_null_string<Arr, array, del, null> {
        pub(in super) array: array,
        pub(in super) del: del,
        pub(in super) null: null,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, del, null, __Rhs> ::core::ops::Add<__Rhs> for
                array_to_string_with_null_string<Arr, array, del, null> 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<Arr, array, del, null, __Rhs> ::core::ops::Sub<__Rhs> for
                array_to_string_with_null_string<Arr, array, del, null> 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<Arr, array, del, null, __Rhs> ::core::ops::Mul<__Rhs> for
                array_to_string_with_null_string<Arr, array, del, null> 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<Arr, array, del, null, __Rhs> ::core::ops::Div<__Rhs> for
                array_to_string_with_null_string<Arr, array, del, null> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        del: ::core::fmt::Debug, null: ::core::fmt::Debug> ::core::fmt::Debug
        for array_to_string_with_null_string<Arr, array, del, null> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_to_string_with_null_string", "array", &self.array,
                "del", &self.del, "null", &self.null, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        del: ::core::clone::Clone, null: ::core::clone::Clone>
        ::core::clone::Clone for
        array_to_string_with_null_string<Arr, array, del, null> {
        #[inline]
        fn clone(&self)
            -> array_to_string_with_null_string<Arr, array, del, null> {
            array_to_string_with_null_string {
                array: ::core::clone::Clone::clone(&self.array),
                del: ::core::clone::Clone::clone(&self.del),
                null: ::core::clone::Clone::clone(&self.null),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        del: ::core::marker::Copy, null: ::core::marker::Copy>
        ::core::marker::Copy for
        array_to_string_with_null_string<Arr, array, del, null> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                del: diesel::query_builder::QueryId,
                null: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_to_string_with_null_string<Arr, array, del, null> {
                type QueryId =
                    array_to_string_with_null_string<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <del as diesel::query_builder::QueryId>::QueryId,
                    <null as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <array as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <del as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <null as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <array as
                                        diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <del as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <null as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc =
    "The return type of [`array_to_string_with_null_string()`](fn@array_to_string_with_null_string)"]
    pub type HelperType<Arr, array, del, null> =
        array_to_string_with_null_string<Arr,
        <array as AsExpression<Arr>>::Expression,
        <del as AsExpression<Text>>::Expression,
        <null as AsExpression<Text>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null> Expression
        for array_to_string_with_null_string<Arr, array, del, null> where
        (array, del, null): Expression {
        type SqlType = Text;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_to_string_with_null_string<Arr, array, del, null> where
        array: SelectableExpression<__DieselInternal>,
        del: SelectableExpression<__DieselInternal>,
        null: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_to_string_with_null_string<Arr, array, del, null> where
        array: AppearsOnTable<__DieselInternal>,
        del: AppearsOnTable<__DieselInternal>,
        null: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_to_string_with_null_string<Arr, array, del, null> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        del: QueryFragment<__DieselInternal>,
        null: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_to_string";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.del.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.del.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.null.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.null.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null>
        QueryFragment<crate::pg::Pg> for
        array_to_string_with_null_string<Arr, array, del, null> where
        array: QueryFragment<crate::pg::Pg>,
        del: QueryFragment<crate::pg::Pg>, null: QueryFragment<crate::pg::Pg>
        {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, del, null>(array, del, null);
    const _: () =
        {
            use diesel;
            impl<array, del, null, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, del, null> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                del: diesel::expression::ValidGrouping<__GroupByClause>,
                null: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<del
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<del as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<null
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<del as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<null as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del, null,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_to_string_with_null_string<Arr, array, del, null> where
        __Derived<array, del, null>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, del, null> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Converts each array element to its text representation and concatenates those elements"]
#[doc =
" separated by the delimiter string. `NULL` entries are omitted in this variant."]
#[doc =
" See [array_to_string_with_null_string](array_to_string_with_null_string()) for a variant with that argument."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_to_string;"]
#[doc = " #     use diesel::sql_types::{Text, Array, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " // Example with non-null values"]
#[doc =
" let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>("]
#[doc = "     vec![Some(\"first\"), Some(\"second\")],"]
#[doc = "     \",\","]
#[doc = " ))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"first,second\");"]
#[doc = ""]
#[doc = " // Example with `NULL` values (omitted in the result)"]
#[doc =
" let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>("]
#[doc = "     vec![Some(\"first\"), None::<&str>, Some(\"third\")],"]
#[doc = "     \",\","]
#[doc = " ))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"first,third\");"]
#[doc = ""]
#[doc = " // Example with only `NULL` values (empty result)"]
#[doc =
" let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>("]
#[doc = "     vec![None::<&str>, None::<&str>],"]
#[doc = "     \",\","]
#[doc = " ))"]
#[doc = " .get_result(connection)?;"]
#[doc = " assert_eq!(result, \"\");"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_to_string<Arr: ArrayOrNullableArray + SingleValue, array,
    del>(array: array, del: del) -> array_to_string<Arr, array, del> where
    array: diesel::expression::AsExpression<Arr>,
    del: diesel::expression::AsExpression<Text> {
    array_to_string_utils::array_to_string {
        array: array.as_expression(),
        del: del.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_to_string()`](fn@array_to_string)"]
pub type array_to_string<Arr, array, del> =
    array_to_string_utils::array_to_string<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <del as diesel::expression::AsExpression<Text>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_to_string_return_type {
    #[doc =
    "Return type of the [`array_to_string()`](fn@super::array_to_string) SQL function."]
    pub type array_to_string<array, del> =
        super::array_to_string<<array as
        diesel::expression::Expression>::SqlType, array, del>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_to_string_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_to_string<Arr, array, del> {
        pub(in super) array: array,
        pub(in super) del: del,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, del, __Rhs> ::core::ops::Add<__Rhs> for
                array_to_string<Arr, array, del> 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<Arr, array, del, __Rhs> ::core::ops::Sub<__Rhs> for
                array_to_string<Arr, array, del> 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<Arr, array, del, __Rhs> ::core::ops::Mul<__Rhs> for
                array_to_string<Arr, array, del> 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<Arr, array, del, __Rhs> ::core::ops::Div<__Rhs> for
                array_to_string<Arr, array, del> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        del: ::core::fmt::Debug> ::core::fmt::Debug for
        array_to_string<Arr, array, del> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_to_string", "array", &self.array, "del", &self.del,
                "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        del: ::core::clone::Clone> ::core::clone::Clone for
        array_to_string<Arr, array, del> {
        #[inline]
        fn clone(&self) -> array_to_string<Arr, array, del> {
            array_to_string {
                array: ::core::clone::Clone::clone(&self.array),
                del: ::core::clone::Clone::clone(&self.del),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        del: ::core::marker::Copy> ::core::marker::Copy for
        array_to_string<Arr, array, del> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                del: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_to_string<Arr, array, del> {
                type QueryId =
                    array_to_string<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <del as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <array as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <del as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <array as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <del as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_to_string()`](fn@array_to_string)"]
    pub type HelperType<Arr, array, del> =
        array_to_string<Arr, <array as AsExpression<Arr>>::Expression,
        <del as AsExpression<Text>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del> Expression for
        array_to_string<Arr, array, del> where (array, del): Expression {
        type SqlType = Text;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_to_string<Arr, array, del> where
        array: SelectableExpression<__DieselInternal>,
        del: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_to_string<Arr, array, del> where
        array: AppearsOnTable<__DieselInternal>,
        del: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_to_string<Arr, array, del> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        del: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_to_string";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.del.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.del.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del>
        QueryFragment<crate::pg::Pg> for array_to_string<Arr, array, del>
        where array: QueryFragment<crate::pg::Pg>,
        del: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, del>(array, del);
    const _: () =
        {
            use diesel;
            impl<array, del, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, del> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                del: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<del
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<del as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, del,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_to_string<Arr, array, del> where
        __Derived<array, del>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, del> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns the total number of elements in the array, or 0 if the array is empty."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::cardinality;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let array_cardinality = diesel::select(cardinality::<Array<Integer>, _>(vec![1, 2, 3, 4]))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(4, array_cardinality);"]
#[doc = ""]
#[doc =
" let array_cardinality = diesel::select(cardinality::<Array<Nullable<Integer>>, _>(vec![Some(1), Some(2), Some(3)]))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(3, array_cardinality);"]
#[doc = ""]
#[doc =
" let array_cardinality = diesel::select(cardinality::<Array<Integer>, _>(Vec::<i32>::new()))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(0, array_cardinality);"]
#[doc = ""]
#[doc =
" let array_cardinality = diesel::select(cardinality::<Nullable<Array<Integer>>, _>(None::<Vec<i32>>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, array_cardinality);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn cardinality<Arr: ArrayOrNullableArray + SingleValue +
    MaybeNullableValue<Integer>, a>(a: a) -> cardinality<Arr, a> where
    a: diesel::expression::AsExpression<Arr> {
    cardinality_utils::cardinality {
        a: a.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`cardinality()`](fn@cardinality)"]
pub type cardinality<Arr, a> =
    cardinality_utils::cardinality<Arr,
    <a as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __cardinality_return_type {
    #[doc =
    "Return type of the [`cardinality()`](fn@super::cardinality) SQL function."]
    pub type cardinality<a> =
        super::cardinality<<a as diesel::expression::Expression>::SqlType, a>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod cardinality_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct cardinality<Arr, a> {
        pub(in super) a: a,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, a, __Rhs> ::core::ops::Add<__Rhs> for
                cardinality<Arr, a> 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<Arr, a, __Rhs> ::core::ops::Sub<__Rhs> for
                cardinality<Arr, a> 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<Arr, a, __Rhs> ::core::ops::Mul<__Rhs> for
                cardinality<Arr, a> 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<Arr, a, __Rhs> ::core::ops::Div<__Rhs> for
                cardinality<Arr, a> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, a: ::core::fmt::Debug> ::core::fmt::Debug
        for cardinality<Arr, a> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "cardinality", "a", &self.a, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, a: ::core::clone::Clone>
        ::core::clone::Clone for cardinality<Arr, a> {
        #[inline]
        fn clone(&self) -> cardinality<Arr, a> {
            cardinality {
                a: ::core::clone::Clone::clone(&self.a),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, a: ::core::marker::Copy>
        ::core::marker::Copy for cardinality<Arr, a> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for cardinality<Arr, a> {
                type QueryId =
                    cardinality<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`cardinality()`](fn@cardinality)"]
    pub type HelperType<Arr, a> =
        cardinality<Arr, <a as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a> Expression for cardinality<Arr, a>
        where (a): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a, __DieselInternal>
        SelectableExpression<__DieselInternal> for cardinality<Arr, a> where
        a: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a, __DieselInternal>
        AppearsOnTable<__DieselInternal> for cardinality<Arr, a> where
        a: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a, __DieselInternal>
        FunctionFragment<__DieselInternal> for cardinality<Arr, a> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "cardinality";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a> QueryFragment<crate::pg::Pg> for
        cardinality<Arr, a> where a: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a>(a);
    const _: () =
        {
            use diesel;
            impl<a, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a> where
                a: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, a, __DieselInternal>
        ValidGrouping<__DieselInternal> for cardinality<Arr, a> where
        __Derived<a>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Trims an array by removing the last n elements. If the array is multidimensional, only the first dimension is trimmed."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::trim_array;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let trimmed_array = diesel::select(trim_array::<Array<Integer>, _, _>(vec![1, 2, 3, 4], 3))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1], trimmed_array);"]
#[doc = ""]
#[doc =
" let trimmed_array = diesel::select(trim_array::<Array<Nullable<Integer>>, _, _>(vec![Some(1), Some(2), Some(3)], 1))"]
#[doc = "     .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(1), Some(2)], trimmed_array);"]
#[doc = ""]
#[doc =
" let trimmed_array = diesel::select(trim_array::<Array<Integer>, _, _>(Vec::<i32>::new(), 0))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(Vec::<i32>::new(), trimmed_array);"]
#[doc = ""]
#[doc =
" let trimmed_array = diesel::select(trim_array::<Nullable<Array<Integer>>, _, _>(None::<Vec<i32>>, 0))"]
#[doc = "     .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = " assert_eq!(None, trimmed_array);"]
#[doc = ""]
#[doc =
" let trimmed_array = diesel::select(trim_array::<Nullable<Array<Integer>>, _, _>(None::<Vec<i32>>, 1))"]
#[doc = "     .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = " assert_eq!(None, trimmed_array);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn trim_array<Arr: ArrayOrNullableArray + SingleValue, a, n>(a: a, n: n)
    -> trim_array<Arr, a, n> where a: diesel::expression::AsExpression<Arr>,
    n: diesel::expression::AsExpression<Integer> {
    trim_array_utils::trim_array {
        a: a.as_expression(),
        n: n.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`trim_array()`](fn@trim_array)"]
pub type trim_array<Arr, a, n> =
    trim_array_utils::trim_array<Arr,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <n as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __trim_array_return_type {
    #[doc =
    "Return type of the [`trim_array()`](fn@super::trim_array) SQL function."]
    pub type trim_array<a, n> =
        super::trim_array<<a as diesel::expression::Expression>::SqlType, a,
        n>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod trim_array_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct trim_array<Arr, a, n> {
        pub(in super) a: a,
        pub(in super) n: n,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, a, n, __Rhs> ::core::ops::Add<__Rhs> for
                trim_array<Arr, a, n> 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<Arr, a, n, __Rhs> ::core::ops::Sub<__Rhs> for
                trim_array<Arr, a, n> 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<Arr, a, n, __Rhs> ::core::ops::Mul<__Rhs> for
                trim_array<Arr, a, n> 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<Arr, a, n, __Rhs> ::core::ops::Div<__Rhs> for
                trim_array<Arr, a, n> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, a: ::core::fmt::Debug,
        n: ::core::fmt::Debug> ::core::fmt::Debug for trim_array<Arr, a, n> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "trim_array", "a", &self.a, "n", &self.n, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, a: ::core::clone::Clone,
        n: ::core::clone::Clone> ::core::clone::Clone for
        trim_array<Arr, a, n> {
        #[inline]
        fn clone(&self) -> trim_array<Arr, a, n> {
            trim_array {
                a: ::core::clone::Clone::clone(&self.a),
                n: ::core::clone::Clone::clone(&self.n),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, a: ::core::marker::Copy,
        n: ::core::marker::Copy> ::core::marker::Copy for
        trim_array<Arr, a, n> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                n: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for trim_array<Arr, a, n> {
                type QueryId =
                    trim_array<<Arr as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <n as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <n as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <n as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`trim_array()`](fn@trim_array)"]
    pub type HelperType<Arr, a, n> =
        trim_array<Arr, <a as AsExpression<Arr>>::Expression,
        <n as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n> Expression for
        trim_array<Arr, a, n> where (a, n): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n, __DieselInternal>
        SelectableExpression<__DieselInternal> for trim_array<Arr, a, n> where
        a: SelectableExpression<__DieselInternal>,
        n: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n, __DieselInternal>
        AppearsOnTable<__DieselInternal> for trim_array<Arr, a, n> where
        a: AppearsOnTable<__DieselInternal>,
        n: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n, __DieselInternal>
        FunctionFragment<__DieselInternal> for trim_array<Arr, a, n> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, n: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "trim_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.n.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.n.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n>
        QueryFragment<crate::pg::Pg> for trim_array<Arr, a, n> where
        a: QueryFragment<crate::pg::Pg>, n: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, n>(a, n);
    const _: () =
        {
            use diesel;
            impl<a, n, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, n> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                n: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<n
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<n as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, a, n, __DieselInternal>
        ValidGrouping<__DieselInternal> for trim_array<Arr, a, n> where
        __Derived<a, n>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, n> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Concatenates two arrays"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_cat;"]
#[doc = " #     use diesel::sql_types::{Integer, Array, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(array_cat::<Array<Integer>, _, _>(vec![1, 2], vec![3, 4]))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1, 2, 3, 4], result);"]
#[doc = ""]
#[doc =
" let nullable_result = diesel::select(array_cat::<Nullable<Array<Integer>>, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     None::<Vec<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = " assert_eq!(None, nullable_result);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_cat<Arr: ArrayOrNullableArray + SingleValue, a, b>(a: a, b: b)
    -> array_cat<Arr, a, b> where a: diesel::expression::AsExpression<Arr>,
    b: diesel::expression::AsExpression<Arr> {
    array_cat_utils::array_cat {
        a: a.as_expression(),
        b: b.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_cat()`](fn@array_cat)"]
pub type array_cat<Arr, a, b> =
    array_cat_utils::array_cat<Arr,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <b as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_cat_return_type {
    #[doc =
    "Return type of the [`array_cat()`](fn@super::array_cat) SQL function."]
    pub type array_cat<a, b> =
        super::array_cat<<a as diesel::expression::Expression>::SqlType, a,
        b>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_cat_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_cat<Arr, a, b> {
        pub(in super) a: a,
        pub(in super) b: b,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, a, b, __Rhs> ::core::ops::Add<__Rhs> for
                array_cat<Arr, a, b> 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<Arr, a, b, __Rhs> ::core::ops::Sub<__Rhs> for
                array_cat<Arr, a, b> 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<Arr, a, b, __Rhs> ::core::ops::Mul<__Rhs> for
                array_cat<Arr, a, b> 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<Arr, a, b, __Rhs> ::core::ops::Div<__Rhs> for
                array_cat<Arr, a, b> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, a: ::core::fmt::Debug,
        b: ::core::fmt::Debug> ::core::fmt::Debug for array_cat<Arr, a, b> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f, "array_cat",
                "a", &self.a, "b", &self.b, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, a: ::core::clone::Clone,
        b: ::core::clone::Clone> ::core::clone::Clone for array_cat<Arr, a, b>
        {
        #[inline]
        fn clone(&self) -> array_cat<Arr, a, b> {
            array_cat {
                a: ::core::clone::Clone::clone(&self.a),
                b: ::core::clone::Clone::clone(&self.b),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, a: ::core::marker::Copy,
        b: ::core::marker::Copy> ::core::marker::Copy for array_cat<Arr, a, b>
        {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                b: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_cat<Arr, a, b> {
                type QueryId =
                    array_cat<<Arr as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <b as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <b as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            || <b as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_cat()`](fn@array_cat)"]
    pub type HelperType<Arr, a, b> =
        array_cat<Arr, <a as AsExpression<Arr>>::Expression,
        <b as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b> Expression for
        array_cat<Arr, a, b> where (a, b): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_cat<Arr, a, b> where
        a: SelectableExpression<__DieselInternal>,
        b: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_cat<Arr, a, b> where
        a: AppearsOnTable<__DieselInternal>,
        b: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_cat<Arr, a, b> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>, b: QueryFragment<__DieselInternal>
        {
        const FUNCTION_NAME: &'static str = "array_cat";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.b.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.b.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b>
        QueryFragment<crate::pg::Pg> for array_cat<Arr, a, b> where
        a: QueryFragment<crate::pg::Pg>, b: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, b>(a, b);
    const _: () =
        {
            use diesel;
            impl<a, b, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, b> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                b: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<b
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<b as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, a, b, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_cat<Arr, a, b> where
        __Derived<a, b>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, b> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the length of the requested array"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_length;"]
#[doc = " #     use diesel::sql_types::{Integer, Array, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(array_length::<Array<Integer>, _, _>(vec![1, 2, 3], 1))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(3), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(array_length::<Array<Integer>, _, _>(vec![1, 2, 3], 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(array_length::<Nullable<Array<Integer>>, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     1,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, result);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_length<Arr: ArrayOrNullableArray + SingleValue, array,
    dimension>(array: array, dimension: dimension)
    -> array_length<Arr, array, dimension> where
    array: diesel::expression::AsExpression<Arr>,
    dimension: diesel::expression::AsExpression<Integer> {
    array_length_utils::array_length {
        array: array.as_expression(),
        dimension: dimension.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_length()`](fn@array_length)"]
pub type array_length<Arr, array, dimension> =
    array_length_utils::array_length<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <dimension as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_length_return_type {
    #[doc =
    "Return type of the [`array_length()`](fn@super::array_length) SQL function."]
    pub type array_length<array, dimension> =
        super::array_length<<array as
        diesel::expression::Expression>::SqlType, array, dimension>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_length_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_length<Arr, array, dimension> {
        pub(in super) array: array,
        pub(in super) dimension: dimension,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, dimension, __Rhs> ::core::ops::Add<__Rhs> for
                array_length<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Sub<__Rhs> for
                array_length<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Mul<__Rhs> for
                array_length<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Div<__Rhs> for
                array_length<Arr, array, dimension> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        dimension: ::core::fmt::Debug> ::core::fmt::Debug for
        array_length<Arr, array, dimension> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_length", "array", &self.array, "dimension",
                &self.dimension, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        dimension: ::core::clone::Clone> ::core::clone::Clone for
        array_length<Arr, array, dimension> {
        #[inline]
        fn clone(&self) -> array_length<Arr, array, dimension> {
            array_length {
                array: ::core::clone::Clone::clone(&self.array),
                dimension: ::core::clone::Clone::clone(&self.dimension),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        dimension: ::core::marker::Copy> ::core::marker::Copy for
        array_length<Arr, array, dimension> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                dimension: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_length<Arr, array, dimension> {
                type QueryId =
                    array_length<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <dimension as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <array as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <dimension as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <array as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <dimension as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_length()`](fn@array_length)"]
    pub type HelperType<Arr, array, dimension> =
        array_length<Arr, <array as AsExpression<Arr>>::Expression,
        <dimension as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension> Expression
        for array_length<Arr, array, dimension> where
        (array, dimension): Expression {
        type SqlType = Nullable<Integer>;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_length<Arr, array, dimension> where
        array: SelectableExpression<__DieselInternal>,
        dimension: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_length<Arr, array, dimension> where
        array: AppearsOnTable<__DieselInternal>,
        dimension: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_length<Arr, array, dimension> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        dimension: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_length";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.dimension.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.dimension.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension>
        QueryFragment<crate::pg::Pg> for array_length<Arr, array, dimension>
        where array: QueryFragment<crate::pg::Pg>,
        dimension: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, dimension>(array, dimension);
    const _: () =
        {
            use diesel;
            impl<array, dimension, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, dimension> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                dimension: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<dimension
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<dimension as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_length<Arr, array, dimension> where
        __Derived<array, dimension>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, dimension> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns an array initialized with supplied value and dimensions,"]
#[doc =
" optionally with lower bounds other than 1. This function omits the optional"]
#[doc =
" lower bound argument. See [array_fill_with_lower_bound](array_fill_with_lower_bound()) for that."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_fill;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer,Text};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let array = diesel::select(array_fill::<Integer,_,_>(2,vec![2]))"]
#[doc = " .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![2,2],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill::<Text,_,_>(String::from(\"abc\"),vec![3]))"]
#[doc = " .get_result::<Vec<String>>(connection)?;"]
#[doc = " assert_eq!(vec![\"abc\",\"abc\",\"abc\"],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill::<Nullable<Integer>,_,_>(Some(4),vec![3]))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(4),Some(4),Some(4)],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill::<Nullable<Integer>,_,_>(None::<i32>,vec![3]))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![None::<i32>,None::<i32>,None::<i32>],array);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_fill<E: SingleValue, value, dim>(value: value, dim: dim)
    -> array_fill<E, value, dim> where
    value: diesel::expression::AsExpression<E>,
    dim: diesel::expression::AsExpression<Array<Integer>> {
    array_fill_utils::array_fill {
        value: value.as_expression(),
        dim: dim.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_fill()`](fn@array_fill)"]
pub type array_fill<E, value, dim> =
    array_fill_utils::array_fill<E,
    <value as diesel::expression::AsExpression<E>>::Expression,
    <dim as diesel::expression::AsExpression<Array<Integer>>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_fill_return_type {
    #[doc =
    "Return type of the [`array_fill()`](fn@super::array_fill) SQL function."]
    pub type array_fill<value, dim> =
        super::array_fill<<value as diesel::expression::Expression>::SqlType,
        value, dim>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_fill_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_fill<E, value, dim> {
        pub(in super) value: value,
        pub(in super) dim: dim,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, value, dim, __Rhs> ::core::ops::Add<__Rhs> for
                array_fill<E, value, dim> 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<E, value, dim, __Rhs> ::core::ops::Sub<__Rhs> for
                array_fill<E, value, dim> 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<E, value, dim, __Rhs> ::core::ops::Mul<__Rhs> for
                array_fill<E, value, dim> 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<E, value, dim, __Rhs> ::core::ops::Div<__Rhs> for
                array_fill<E, value, dim> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, value: ::core::fmt::Debug,
        dim: ::core::fmt::Debug> ::core::fmt::Debug for
        array_fill<E, value, dim> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_fill", "value", &self.value, "dim", &self.dim, "E",
                &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, value: ::core::clone::Clone,
        dim: ::core::clone::Clone> ::core::clone::Clone for
        array_fill<E, value, dim> {
        #[inline]
        fn clone(&self) -> array_fill<E, value, dim> {
            array_fill {
                value: ::core::clone::Clone::clone(&self.value),
                dim: ::core::clone::Clone::clone(&self.dim),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, value: ::core::marker::Copy,
        dim: ::core::marker::Copy> ::core::marker::Copy for
        array_fill<E, value, dim> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                value: diesel::query_builder::QueryId,
                dim: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_fill<E, value, dim> {
                type QueryId =
                    array_fill<<E as diesel::query_builder::QueryId>::QueryId,
                    <value as diesel::query_builder::QueryId>::QueryId,
                    <dim as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <value as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <dim as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <value as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <dim as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_fill()`](fn@array_fill)"]
    pub type HelperType<E, value, dim> =
        array_fill<E, <value as AsExpression<E>>::Expression,
        <dim as AsExpression<Array<Integer>>>::Expression>;
    impl<E: SingleValue, value, dim> Expression for array_fill<E, value, dim>
        where (value, dim): Expression {
        type SqlType = Array<E>;
    }
    impl<E: SingleValue, value, dim, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_fill<E, value, dim>
        where value: SelectableExpression<__DieselInternal>,
        dim: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: SingleValue, value, dim, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_fill<E, value, dim> where
        value: AppearsOnTable<__DieselInternal>,
        dim: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: SingleValue, value, dim, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_fill<E, value, dim> where
        __DieselInternal: diesel::backend::Backend,
        value: QueryFragment<__DieselInternal>,
        dim: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_fill";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.dim.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.dim.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: SingleValue, value, dim> QueryFragment<crate::pg::Pg> for
        array_fill<E, value, dim> where value: QueryFragment<crate::pg::Pg>,
        dim: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value, dim>(value, dim);
    const _: () =
        {
            use diesel;
            impl<value, dim, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value, dim> where
                value: diesel::expression::ValidGrouping<__GroupByClause>,
                dim: diesel::expression::ValidGrouping<__GroupByClause>,
                <value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<dim
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<dim as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: SingleValue, value, dim, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_fill<E, value, dim> where
        __Derived<value, dim>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value, dim> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns an array initialized with supplied value and dimensions,"]
#[doc = " with lower bounds other than 1"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_fill_with_lower_bound;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer,Text};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill_with_lower_bound::<Integer,_,_,_>(2,vec![2],vec![2]))"]
#[doc = " .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![2,2],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill_with_lower_bound::<Text,_,_,_>(String::from(\"abc\"),vec![3],vec![3]))"]
#[doc = " .get_result::<Vec<String>>(connection)?;"]
#[doc = " assert_eq!(vec![\"abc\",\"abc\",\"abc\"],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill_with_lower_bound::<Nullable<Integer>,_,_,_>(Some(4),vec![3],vec![3]))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![Some(4),Some(4),Some(4)],array);"]
#[doc = ""]
#[doc =
" let array = diesel::select(array_fill_with_lower_bound::<Nullable<Integer>,_,_,_>(None::<i32>,vec![3],vec![3]))"]
#[doc = " .get_result::<Vec<Option<i32>>>(connection)?;"]
#[doc = " assert_eq!(vec![None::<i32>,None::<i32>,None::<i32>],array);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_fill_with_lower_bound<E: SingleValue, value, dim,
    lower_bound>(value: value, dim: dim, lower_bound: lower_bound)
    -> array_fill_with_lower_bound<E, value, dim, lower_bound> where
    value: diesel::expression::AsExpression<E>,
    dim: diesel::expression::AsExpression<Array<Integer>>,
    lower_bound: diesel::expression::AsExpression<Array<Integer>> {
    array_fill_with_lower_bound_utils::array_fill_with_lower_bound {
        value: value.as_expression(),
        dim: dim.as_expression(),
        lower_bound: lower_bound.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`array_fill_with_lower_bound()`](fn@array_fill_with_lower_bound)"]
pub type array_fill_with_lower_bound<E, value, dim, lower_bound> =
    array_fill_with_lower_bound_utils::array_fill_with_lower_bound<E,
    <value as diesel::expression::AsExpression<E>>::Expression,
    <dim as diesel::expression::AsExpression<Array<Integer>>>::Expression,
    <lower_bound as
    diesel::expression::AsExpression<Array<Integer>>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_fill_with_lower_bound_return_type {
    #[doc =
    "Return type of the [`array_fill_with_lower_bound()`](fn@super::array_fill_with_lower_bound) SQL function."]
    pub type array_fill_with_lower_bound<value, dim, lower_bound> =
        super::array_fill_with_lower_bound<<value as
        diesel::expression::Expression>::SqlType, value, dim, lower_bound>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_fill_with_lower_bound_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_fill_with_lower_bound<E, value, dim, lower_bound> {
        pub(in super) value: value,
        pub(in super) dim: dim,
        pub(in super) lower_bound: lower_bound,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, value, dim, lower_bound, __Rhs> ::core::ops::Add<__Rhs>
                for array_fill_with_lower_bound<E, value, dim, lower_bound>
                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<E, value, dim, lower_bound, __Rhs> ::core::ops::Sub<__Rhs>
                for array_fill_with_lower_bound<E, value, dim, lower_bound>
                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<E, value, dim, lower_bound, __Rhs> ::core::ops::Mul<__Rhs>
                for array_fill_with_lower_bound<E, value, dim, lower_bound>
                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<E, value, dim, lower_bound, __Rhs> ::core::ops::Div<__Rhs>
                for array_fill_with_lower_bound<E, value, dim, lower_bound>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, value: ::core::fmt::Debug,
        dim: ::core::fmt::Debug, lower_bound: ::core::fmt::Debug>
        ::core::fmt::Debug for
        array_fill_with_lower_bound<E, value, dim, lower_bound> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_fill_with_lower_bound", "value", &self.value, "dim",
                &self.dim, "lower_bound", &self.lower_bound, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, value: ::core::clone::Clone,
        dim: ::core::clone::Clone, lower_bound: ::core::clone::Clone>
        ::core::clone::Clone for
        array_fill_with_lower_bound<E, value, dim, lower_bound> {
        #[inline]
        fn clone(&self)
            -> array_fill_with_lower_bound<E, value, dim, lower_bound> {
            array_fill_with_lower_bound {
                value: ::core::clone::Clone::clone(&self.value),
                dim: ::core::clone::Clone::clone(&self.dim),
                lower_bound: ::core::clone::Clone::clone(&self.lower_bound),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, value: ::core::marker::Copy,
        dim: ::core::marker::Copy, lower_bound: ::core::marker::Copy>
        ::core::marker::Copy for
        array_fill_with_lower_bound<E, value, dim, lower_bound> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                value: diesel::query_builder::QueryId,
                dim: diesel::query_builder::QueryId,
                lower_bound: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_fill_with_lower_bound<E, value, dim, lower_bound> {
                type QueryId =
                    array_fill_with_lower_bound<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <value as diesel::query_builder::QueryId>::QueryId,
                    <dim as diesel::query_builder::QueryId>::QueryId,
                    <lower_bound as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <value as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <dim as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <lower_bound as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <value as
                                        diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <dim as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <lower_bound as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`array_fill_with_lower_bound()`](fn@array_fill_with_lower_bound)"]
    pub type HelperType<E, value, dim, lower_bound> =
        array_fill_with_lower_bound<E, <value as AsExpression<E>>::Expression,
        <dim as AsExpression<Array<Integer>>>::Expression,
        <lower_bound as AsExpression<Array<Integer>>>::Expression>;
    impl<E: SingleValue, value, dim, lower_bound> Expression for
        array_fill_with_lower_bound<E, value, dim, lower_bound> where
        (value, dim, lower_bound): Expression {
        type SqlType = Array<E>;
    }
    impl<E: SingleValue, value, dim, lower_bound, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        array_fill_with_lower_bound<E, value, dim, lower_bound> where
        value: SelectableExpression<__DieselInternal>,
        dim: SelectableExpression<__DieselInternal>,
        lower_bound: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: SingleValue, value, dim, lower_bound, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        array_fill_with_lower_bound<E, value, dim, lower_bound> where
        value: AppearsOnTable<__DieselInternal>,
        dim: AppearsOnTable<__DieselInternal>,
        lower_bound: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: SingleValue, value, dim, lower_bound, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        array_fill_with_lower_bound<E, value, dim, lower_bound> where
        __DieselInternal: diesel::backend::Backend,
        value: QueryFragment<__DieselInternal>,
        dim: QueryFragment<__DieselInternal>,
        lower_bound: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_fill";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.dim.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.dim.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.lower_bound.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.lower_bound.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: SingleValue, value, dim, lower_bound> QueryFragment<crate::pg::Pg>
        for array_fill_with_lower_bound<E, value, dim, lower_bound> where
        value: QueryFragment<crate::pg::Pg>,
        dim: QueryFragment<crate::pg::Pg>,
        lower_bound: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value, dim, lower_bound>(value, dim, lower_bound);
    const _: () =
        {
            use diesel;
            impl<value, dim, lower_bound, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value, dim, lower_bound> where
                value: diesel::expression::ValidGrouping<__GroupByClause>,
                dim: diesel::expression::ValidGrouping<__GroupByClause>,
                lower_bound: diesel::expression::ValidGrouping<__GroupByClause>,
                <value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<dim
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<dim as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<lower_bound
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<dim as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<lower_bound as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: SingleValue, value, dim, lower_bound, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        array_fill_with_lower_bound<E, value, dim, lower_bound> where
        __Derived<value, dim, lower_bound>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value, dim, lower_bound> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the lower bound of the requested array"]
#[doc = ""]
#[doc = " This function returns null for dimensions that do not exist"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_lower;"]
#[doc = " #     use diesel::sql_types::{Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 1))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(1), result);"]
#[doc = ""]
#[doc = " // the array has only one dimension"]
#[doc =
" let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, result);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_lower<Arr: ArrayOrNullableArray + SingleValue, array,
    dimension>(array: array, dimension: dimension)
    -> array_lower<Arr, array, dimension> where
    array: diesel::expression::AsExpression<Arr>,
    dimension: diesel::expression::AsExpression<Integer> {
    array_lower_utils::array_lower {
        array: array.as_expression(),
        dimension: dimension.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_lower()`](fn@array_lower)"]
pub type array_lower<Arr, array, dimension> =
    array_lower_utils::array_lower<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <dimension as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_lower_return_type {
    #[doc =
    "Return type of the [`array_lower()`](fn@super::array_lower) SQL function."]
    pub type array_lower<array, dimension> =
        super::array_lower<<array as diesel::expression::Expression>::SqlType,
        array, dimension>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_lower_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_lower<Arr, array, dimension> {
        pub(in super) array: array,
        pub(in super) dimension: dimension,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, dimension, __Rhs> ::core::ops::Add<__Rhs> for
                array_lower<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Sub<__Rhs> for
                array_lower<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Mul<__Rhs> for
                array_lower<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Div<__Rhs> for
                array_lower<Arr, array, dimension> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        dimension: ::core::fmt::Debug> ::core::fmt::Debug for
        array_lower<Arr, array, dimension> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_lower", "array", &self.array, "dimension",
                &self.dimension, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        dimension: ::core::clone::Clone> ::core::clone::Clone for
        array_lower<Arr, array, dimension> {
        #[inline]
        fn clone(&self) -> array_lower<Arr, array, dimension> {
            array_lower {
                array: ::core::clone::Clone::clone(&self.array),
                dimension: ::core::clone::Clone::clone(&self.dimension),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        dimension: ::core::marker::Copy> ::core::marker::Copy for
        array_lower<Arr, array, dimension> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                dimension: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_lower<Arr, array, dimension> {
                type QueryId =
                    array_lower<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <dimension as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <array as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <dimension as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <array as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <dimension as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_lower()`](fn@array_lower)"]
    pub type HelperType<Arr, array, dimension> =
        array_lower<Arr, <array as AsExpression<Arr>>::Expression,
        <dimension as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension> Expression
        for array_lower<Arr, array, dimension> where
        (array, dimension): Expression {
        type SqlType = Nullable<Integer>;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_lower<Arr, array, dimension> where
        array: SelectableExpression<__DieselInternal>,
        dimension: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_lower<Arr, array, dimension> where
        array: AppearsOnTable<__DieselInternal>,
        dimension: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_lower<Arr, array, dimension> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        dimension: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_lower";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.dimension.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.dimension.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension>
        QueryFragment<crate::pg::Pg> for array_lower<Arr, array, dimension>
        where array: QueryFragment<crate::pg::Pg>,
        dimension: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, dimension>(array, dimension);
    const _: () =
        {
            use diesel;
            impl<array, dimension, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, dimension> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                dimension: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<dimension
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<dimension as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_lower<Arr, array, dimension> where
        __Derived<array, dimension>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, dimension> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns the subscript of the first occurrence of the second argument in the array, or NULL if it\'s not present."]
#[doc =
" If the third argument is given, the search begins at that subscript. This function omits the third argument."]
#[doc =
" See [array_position_with_subscript](array_position_with_subscript())."]
#[doc = ""]
#[doc =
" The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics,"]
#[doc = " so it is possible to search for NULL."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_position;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 3))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(3), pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 5))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None::<i32>, pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position::<Array<_>, Nullable<Integer>, _, _>("]
#[doc = "     vec![1, 2, 3, 4], None::<i32>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None::<i32>, pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position::<Array<_>, Nullable<Integer>, _, _>("]
#[doc = "     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(1), pos);"]
#[doc = ""]
#[doc =
" let dims = diesel::select(array_position::<Nullable<Array<Integer>>, Integer, _, _>(None::<Vec<i32>>, 1))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, dims);"]
#[doc = ""]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_position<Arr: ArrayOrNullableArray<Inner = E> + SingleValue,
    E: SingleValue, a, elem>(a: a, elem: elem)
    -> array_position<Arr, E, a, elem> where
    a: diesel::expression::AsExpression<Arr>,
    elem: diesel::expression::AsExpression<E> {
    array_position_utils::array_position {
        a: a.as_expression(),
        elem: elem.as_expression(),
        Arr: ::core::marker::PhantomData,
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_position()`](fn@array_position)"]
pub type array_position<Arr, E, a, elem> =
    array_position_utils::array_position<Arr, E,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <elem as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_position_return_type {
    #[doc =
    "Return type of the [`array_position()`](fn@super::array_position) SQL function."]
    pub type array_position<a, elem> =
        super::array_position<<a as diesel::expression::Expression>::SqlType,
        <elem as diesel::expression::Expression>::SqlType, a, elem>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_position_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_position<Arr, E, a, elem> {
        pub(in super) a: a,
        pub(in super) elem: elem,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<Arr, E, a, elem, __Rhs> ::core::ops::Add<__Rhs> for
                array_position<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Sub<__Rhs> for
                array_position<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Mul<__Rhs> for
                array_position<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Div<__Rhs> for
                array_position<Arr, E, a, elem> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, E: ::core::fmt::Debug,
        a: ::core::fmt::Debug, elem: ::core::fmt::Debug> ::core::fmt::Debug
        for array_position<Arr, E, a, elem> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_position", "a", &self.a, "elem", &self.elem, "Arr",
                &self.Arr, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, E: ::core::clone::Clone,
        a: ::core::clone::Clone, elem: ::core::clone::Clone>
        ::core::clone::Clone for array_position<Arr, E, a, elem> {
        #[inline]
        fn clone(&self) -> array_position<Arr, E, a, elem> {
            array_position {
                a: ::core::clone::Clone::clone(&self.a),
                elem: ::core::clone::Clone::clone(&self.elem),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, E: ::core::marker::Copy,
        a: ::core::marker::Copy, elem: ::core::marker::Copy>
        ::core::marker::Copy for array_position<Arr, E, a, elem> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                E: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                elem: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_position<Arr, E, a, elem> {
                type QueryId =
                    array_position<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <E as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <elem as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <elem as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <elem as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_position()`](fn@array_position)"]
    pub type HelperType<Arr, E, a, elem> =
        array_position<Arr, E, <a as AsExpression<Arr>>::Expression,
        <elem as AsExpression<E>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem> Expression for array_position<Arr, E, a, elem> where
        (a, elem): Expression {
        type SqlType = Nullable<Integer>;
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, __DieselInternal> SelectableExpression<__DieselInternal> for
        array_position<Arr, E, a, elem> where
        a: SelectableExpression<__DieselInternal>,
        elem: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_position<Arr, E, a, elem> where
        a: AppearsOnTable<__DieselInternal>,
        elem: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, __DieselInternal> FunctionFragment<__DieselInternal> for
        array_position<Arr, E, a, elem> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>,
        elem: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_position";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.elem.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.elem.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem> QueryFragment<crate::pg::Pg> for
        array_position<Arr, E, a, elem> where a: QueryFragment<crate::pg::Pg>,
        elem: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, elem>(a, elem);
    const _: () =
        {
            use diesel;
            impl<a, elem, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, elem> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                elem: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<elem
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<elem as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, __DieselInternal> ValidGrouping<__DieselInternal> for
        array_position<Arr, E, a, elem> where
        __Derived<a, elem>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, elem> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns the subscript of the first occurrence of the second argument in the array,"]
#[doc =
" or NULL if it\'s not present, beginning at the subscript given as the third argument."]
#[doc = ""]
#[doc = " The array must be one-dimensional."]
#[doc = " Comparisons are done using IS NOT DISTINCT FROM semantics,"]
#[doc = " so it is possible to search for NULL."]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_position_with_subscript;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position_with_subscript::<Array<_>, Integer, _, _, _>("]
#[doc = "     vec![1, 2, 3, 4], 3, 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(3), pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position_with_subscript::<Array<_>, Integer, _, _, _>("]
#[doc = "     vec![1, 2, 3, 4], 1, 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None::<i32>, pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position_with_subscript::<Array<_>, Nullable<Integer>, _, _, _>("]
#[doc = "     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>, 1))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(1), pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_position_with_subscript::<Array<_>, Nullable<Integer>, _, _, _>("]
#[doc = "     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>, 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None::<i32>, pos);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_position_with_subscript<Arr: ArrayOrNullableArray<Inner = E> +
    SingleValue, E: SingleValue, a, elem,
    subscript>(a: a, elem: elem, subscript: subscript)
    -> array_position_with_subscript<Arr, E, a, elem, subscript> where
    a: diesel::expression::AsExpression<Arr>,
    elem: diesel::expression::AsExpression<E>,
    subscript: diesel::expression::AsExpression<Integer> {
    array_position_with_subscript_utils::array_position_with_subscript {
        a: a.as_expression(),
        elem: elem.as_expression(),
        subscript: subscript.as_expression(),
        Arr: ::core::marker::PhantomData,
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`array_position_with_subscript()`](fn@array_position_with_subscript)"]
pub type array_position_with_subscript<Arr, E, a, elem, subscript> =
    array_position_with_subscript_utils::array_position_with_subscript<Arr, E,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <elem as diesel::expression::AsExpression<E>>::Expression,
    <subscript as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_position_with_subscript_return_type {
    #[doc =
    "Return type of the [`array_position_with_subscript()`](fn@super::array_position_with_subscript) SQL function."]
    pub type array_position_with_subscript<a, elem, subscript> =
        super::array_position_with_subscript<<a as
        diesel::expression::Expression>::SqlType,
        <elem as diesel::expression::Expression>::SqlType, a, elem,
        subscript>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_position_with_subscript_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_position_with_subscript<Arr, E, a, elem, subscript> {
        pub(in super) a: a,
        pub(in super) elem: elem,
        pub(in super) subscript: subscript,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<Arr, E, a, elem, subscript, __Rhs> ::core::ops::Add<__Rhs>
                for array_position_with_subscript<Arr, E, a, elem, subscript>
                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<Arr, E, a, elem, subscript, __Rhs> ::core::ops::Sub<__Rhs>
                for array_position_with_subscript<Arr, E, a, elem, subscript>
                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<Arr, E, a, elem, subscript, __Rhs> ::core::ops::Mul<__Rhs>
                for array_position_with_subscript<Arr, E, a, elem, subscript>
                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<Arr, E, a, elem, subscript, __Rhs> ::core::ops::Div<__Rhs>
                for array_position_with_subscript<Arr, E, a, elem, subscript>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, E: ::core::fmt::Debug,
        a: ::core::fmt::Debug, elem: ::core::fmt::Debug,
        subscript: ::core::fmt::Debug> ::core::fmt::Debug for
        array_position_with_subscript<Arr, E, a, elem, subscript> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field5_finish(f,
                "array_position_with_subscript", "a", &self.a, "elem",
                &self.elem, "subscript", &self.subscript, "Arr", &self.Arr,
                "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, E: ::core::clone::Clone,
        a: ::core::clone::Clone, elem: ::core::clone::Clone,
        subscript: ::core::clone::Clone> ::core::clone::Clone for
        array_position_with_subscript<Arr, E, a, elem, subscript> {
        #[inline]
        fn clone(&self)
            -> array_position_with_subscript<Arr, E, a, elem, subscript> {
            array_position_with_subscript {
                a: ::core::clone::Clone::clone(&self.a),
                elem: ::core::clone::Clone::clone(&self.elem),
                subscript: ::core::clone::Clone::clone(&self.subscript),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, E: ::core::marker::Copy,
        a: ::core::marker::Copy, elem: ::core::marker::Copy,
        subscript: ::core::marker::Copy> ::core::marker::Copy for
        array_position_with_subscript<Arr, E, a, elem, subscript> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                E: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                elem: diesel::query_builder::QueryId,
                subscript: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_position_with_subscript<Arr, E, a, elem, subscript> {
                type QueryId =
                    array_position_with_subscript<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <E as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <elem as diesel::query_builder::QueryId>::QueryId,
                    <subscript as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <elem as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <subscript as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        || <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <elem as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <subscript as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`array_position_with_subscript()`](fn@array_position_with_subscript)"]
    pub type HelperType<Arr, E, a, elem, subscript> =
        array_position_with_subscript<Arr, E,
        <a as AsExpression<Arr>>::Expression,
        <elem as AsExpression<E>>::Expression,
        <subscript as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript> Expression for
        array_position_with_subscript<Arr, E, a, elem, subscript> where
        (a, elem, subscript): Expression {
        type SqlType = Nullable<Integer>;
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        array_position_with_subscript<Arr, E, a, elem, subscript> where
        a: SelectableExpression<__DieselInternal>,
        elem: SelectableExpression<__DieselInternal>,
        subscript: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript, __DieselInternal> AppearsOnTable<__DieselInternal>
        for array_position_with_subscript<Arr, E, a, elem, subscript> where
        a: AppearsOnTable<__DieselInternal>,
        elem: AppearsOnTable<__DieselInternal>,
        subscript: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        array_position_with_subscript<Arr, E, a, elem, subscript> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>,
        elem: QueryFragment<__DieselInternal>,
        subscript: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_position";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.elem.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.elem.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.subscript.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.subscript.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript> QueryFragment<crate::pg::Pg> for
        array_position_with_subscript<Arr, E, a, elem, subscript> where
        a: QueryFragment<crate::pg::Pg>, elem: QueryFragment<crate::pg::Pg>,
        subscript: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, elem, subscript>(a, elem, subscript);
    const _: () =
        {
            use diesel;
            impl<a, elem, subscript, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, elem, subscript> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                elem: diesel::expression::ValidGrouping<__GroupByClause>,
                subscript: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<elem
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<elem as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<subscript
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<elem as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<subscript as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue,
        a, elem, subscript, __DieselInternal> ValidGrouping<__DieselInternal>
        for array_position_with_subscript<Arr, E, a, elem, subscript> where
        __Derived<a, elem, subscript>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, elem, subscript> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns an array of the subscripts of all occurrences of the second argument in the"]
#[doc = " array given as first argument."]
#[doc = ""]
#[doc =
" The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics,"]
#[doc = " so it is possible to search for NULL."]
#[doc =
" NULL is returned only if the array is NULL; if the value is not found in the array, an empty array is returned."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main(){"]
#[doc = " #    run_test().unwrap();"]
#[doc = " # }"]
#[doc = " # fn run_test()->QueryResult<()>{"]
#[doc = " #   use diesel::dsl::array_positions;"]
#[doc = " #   use diesel::sql_types::{Nullable,Array,Integer};"]
#[doc = " #   let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_positions::<Array<_>, Integer, _, _>(vec![1, 1, 2, 1], 1))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1,2,4], pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_positions::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 5))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(Vec::<i32>::new(), pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_positions::<Array<_>, Nullable<Integer>, _, _>("]
#[doc =
"     vec![None::<i32>, Some(2), Some(3), None::<i32>], None::<i32>))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(vec![1,4], pos);"]
#[doc = ""]
#[doc =
" let pos = diesel::select(array_positions::<Nullable<Array<_>>, Integer, _, _>("]
#[doc = "     None::<Vec<i32>>, 1))"]
#[doc = "     .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = " assert_eq!(None::<Vec<i32>>, pos);"]
#[doc = " # Ok(())"]
#[doc = " # }"]
#[allow(non_camel_case_types)]
pub fn array_positions<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
    MaybeNullableValue<Array<Integer>>, E: SingleValue, a,
    elem>(a: a, elem: elem) -> array_positions<Arr, E, a, elem> where
    a: diesel::expression::AsExpression<Arr>,
    elem: diesel::expression::AsExpression<E> {
    array_positions_utils::array_positions {
        a: a.as_expression(),
        elem: elem.as_expression(),
        Arr: ::core::marker::PhantomData,
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_positions()`](fn@array_positions)"]
pub type array_positions<Arr, E, a, elem> =
    array_positions_utils::array_positions<Arr, E,
    <a as diesel::expression::AsExpression<Arr>>::Expression,
    <elem as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_positions_return_type {
    #[doc =
    "Return type of the [`array_positions()`](fn@super::array_positions) SQL function."]
    pub type array_positions<a, elem> =
        super::array_positions<<a as diesel::expression::Expression>::SqlType,
        <elem as diesel::expression::Expression>::SqlType, a, elem>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_positions_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_positions<Arr, E, a, elem> {
        pub(in super) a: a,
        pub(in super) elem: elem,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<Arr, E, a, elem, __Rhs> ::core::ops::Add<__Rhs> for
                array_positions<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Sub<__Rhs> for
                array_positions<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Mul<__Rhs> for
                array_positions<Arr, E, a, elem> 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<Arr, E, a, elem, __Rhs> ::core::ops::Div<__Rhs> for
                array_positions<Arr, E, a, elem> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, E: ::core::fmt::Debug,
        a: ::core::fmt::Debug, elem: ::core::fmt::Debug> ::core::fmt::Debug
        for array_positions<Arr, E, a, elem> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "array_positions", "a", &self.a, "elem", &self.elem, "Arr",
                &self.Arr, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, E: ::core::clone::Clone,
        a: ::core::clone::Clone, elem: ::core::clone::Clone>
        ::core::clone::Clone for array_positions<Arr, E, a, elem> {
        #[inline]
        fn clone(&self) -> array_positions<Arr, E, a, elem> {
            array_positions {
                a: ::core::clone::Clone::clone(&self.a),
                elem: ::core::clone::Clone::clone(&self.elem),
                Arr: ::core::clone::Clone::clone(&self.Arr),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, E: ::core::marker::Copy,
        a: ::core::marker::Copy, elem: ::core::marker::Copy>
        ::core::marker::Copy for array_positions<Arr, E, a, elem> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                E: diesel::query_builder::QueryId,
                a: diesel::query_builder::QueryId,
                elem: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_positions<Arr, E, a, elem> {
                type QueryId =
                    array_positions<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <E as diesel::query_builder::QueryId>::QueryId,
                    <a as diesel::query_builder::QueryId>::QueryId,
                    <elem as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <a as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <elem as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    || <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                || <a as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <elem as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_positions()`](fn@array_positions)"]
    pub type HelperType<Arr, E, a, elem> =
        array_positions<Arr, E, <a as AsExpression<Arr>>::Expression,
        <elem as AsExpression<E>>::Expression>;
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem>
        Expression for array_positions<Arr, E, a, elem> where
        (a, elem): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_positions<Arr, E, a, elem> where
        a: SelectableExpression<__DieselInternal>,
        elem: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_positions<Arr, E, a, elem> where
        a: AppearsOnTable<__DieselInternal>,
        elem: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_positions<Arr, E, a, elem> where
        __DieselInternal: diesel::backend::Backend,
        a: QueryFragment<__DieselInternal>,
        elem: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_positions";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.a.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.a.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.elem.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.elem.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem>
        QueryFragment<crate::pg::Pg> for array_positions<Arr, E, a, elem>
        where a: QueryFragment<crate::pg::Pg>,
        elem: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<a, elem>(a, elem);
    const _: () =
        {
            use diesel;
            impl<a, elem, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<a, elem> where
                a: diesel::expression::ValidGrouping<__GroupByClause>,
                elem: diesel::expression::ValidGrouping<__GroupByClause>,
                <a as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<elem
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<a as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<elem as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray<Inner = E> + SingleValue +
        MaybeNullableValue<Array<Integer>>, E: SingleValue, a, elem,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_positions<Arr, E, a, elem> where
        __Derived<a, elem>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<a, elem> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the number of dimensions of the array"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_ndims;"]
#[doc = " #     use diesel::sql_types::{Nullable, Array, Integer};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " // diesel currently only supports 1D arrays"]
#[doc =
" let dims = diesel::select(array_ndims::<Array<Integer>, _>(vec![1, 2]))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(1, dims);"]
#[doc = ""]
#[doc =
" let dims = diesel::select(array_ndims::<Nullable<Array<Integer>>, _>(None::<Vec<i32>>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, dims);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_ndims<Arr: ArrayOrNullableArray + SingleValue +
    MaybeNullableValue<Integer>, arr>(arr: arr) -> array_ndims<Arr, arr> where
    arr: diesel::expression::AsExpression<Arr> {
    array_ndims_utils::array_ndims {
        arr: arr.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_ndims()`](fn@array_ndims)"]
pub type array_ndims<Arr, arr> =
    array_ndims_utils::array_ndims<Arr,
    <arr as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_ndims_return_type {
    #[doc =
    "Return type of the [`array_ndims()`](fn@super::array_ndims) SQL function."]
    pub type array_ndims<arr> =
        super::array_ndims<<arr as diesel::expression::Expression>::SqlType,
        arr>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_ndims_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_ndims<Arr, arr> {
        pub(in super) arr: arr,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, arr, __Rhs> ::core::ops::Add<__Rhs> for
                array_ndims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Sub<__Rhs> for
                array_ndims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Mul<__Rhs> for
                array_ndims<Arr, arr> 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<Arr, arr, __Rhs> ::core::ops::Div<__Rhs> for
                array_ndims<Arr, arr> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, arr: ::core::fmt::Debug> ::core::fmt::Debug
        for array_ndims<Arr, arr> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "array_ndims", "arr", &self.arr, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, arr: ::core::clone::Clone>
        ::core::clone::Clone for array_ndims<Arr, arr> {
        #[inline]
        fn clone(&self) -> array_ndims<Arr, arr> {
            array_ndims {
                arr: ::core::clone::Clone::clone(&self.arr),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, arr: ::core::marker::Copy>
        ::core::marker::Copy for array_ndims<Arr, arr> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                arr: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_ndims<Arr, arr> {
                type QueryId =
                    array_ndims<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <arr as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`array_ndims()`](fn@array_ndims)"]
    pub type HelperType<Arr, arr> =
        array_ndims<Arr, <arr as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr> Expression for array_ndims<Arr, arr>
        where (arr): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_ndims<Arr, arr> where
        arr: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_ndims<Arr, arr> where
        arr: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_ndims<Arr, arr> where
        __DieselInternal: diesel::backend::Backend,
        arr: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_ndims";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.arr.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.arr.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr> QueryFragment<crate::pg::Pg> for
        array_ndims<Arr, arr> where arr: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<arr>(arr);
    const _: () =
        {
            use diesel;
            impl<arr, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<arr> where
                arr: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <arr as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue +
        MaybeNullableValue<Integer>, arr, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_ndims<Arr, arr> where
        __Derived<arr>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<arr> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the upper bound of the requested array"]
#[doc = ""]
#[doc = " This function returns null for dimensions that do not exist"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_upper;"]
#[doc = " #     use diesel::sql_types::{Integer, Array};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(array_upper::<Array<Integer>, _, _>(vec![1, 2, 3], 1))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(Some(3), result);"]
#[doc = ""]
#[doc = " // the array has only one dimension"]
#[doc =
" let result = diesel::select(array_upper::<Array<Integer>, _, _>(vec![1, 2, 3], 2))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert_eq!(None, result);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_upper<Arr: ArrayOrNullableArray + SingleValue, array,
    dimension>(array: array, dimension: dimension)
    -> array_upper<Arr, array, dimension> where
    array: diesel::expression::AsExpression<Arr>,
    dimension: diesel::expression::AsExpression<Integer> {
    array_upper_utils::array_upper {
        array: array.as_expression(),
        dimension: dimension.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_upper()`](fn@array_upper)"]
pub type array_upper<Arr, array, dimension> =
    array_upper_utils::array_upper<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <dimension as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_upper_return_type {
    #[doc =
    "Return type of the [`array_upper()`](fn@super::array_upper) SQL function."]
    pub type array_upper<array, dimension> =
        super::array_upper<<array as diesel::expression::Expression>::SqlType,
        array, dimension>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_upper_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_upper<Arr, array, dimension> {
        pub(in super) array: array,
        pub(in super) dimension: dimension,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, dimension, __Rhs> ::core::ops::Add<__Rhs> for
                array_upper<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Sub<__Rhs> for
                array_upper<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Mul<__Rhs> for
                array_upper<Arr, array, dimension> 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<Arr, array, dimension, __Rhs> ::core::ops::Div<__Rhs> for
                array_upper<Arr, array, dimension> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        dimension: ::core::fmt::Debug> ::core::fmt::Debug for
        array_upper<Arr, array, dimension> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_upper", "array", &self.array, "dimension",
                &self.dimension, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        dimension: ::core::clone::Clone> ::core::clone::Clone for
        array_upper<Arr, array, dimension> {
        #[inline]
        fn clone(&self) -> array_upper<Arr, array, dimension> {
            array_upper {
                array: ::core::clone::Clone::clone(&self.array),
                dimension: ::core::clone::Clone::clone(&self.dimension),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        dimension: ::core::marker::Copy> ::core::marker::Copy for
        array_upper<Arr, array, dimension> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                dimension: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                array_upper<Arr, array, dimension> {
                type QueryId =
                    array_upper<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <dimension as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <array as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <dimension as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <array as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <dimension as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_upper()`](fn@array_upper)"]
    pub type HelperType<Arr, array, dimension> =
        array_upper<Arr, <array as AsExpression<Arr>>::Expression,
        <dimension as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension> Expression
        for array_upper<Arr, array, dimension> where
        (array, dimension): Expression {
        type SqlType = Nullable<Integer>;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_upper<Arr, array, dimension> where
        array: SelectableExpression<__DieselInternal>,
        dimension: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_upper<Arr, array, dimension> where
        array: AppearsOnTable<__DieselInternal>,
        dimension: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_upper<Arr, array, dimension> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        dimension: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_upper";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.dimension.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.dimension.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension>
        QueryFragment<crate::pg::Pg> for array_upper<Arr, array, dimension>
        where array: QueryFragment<crate::pg::Pg>,
        dimension: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, dimension>(array, dimension);
    const _: () =
        {
            use diesel;
            impl<array, dimension, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, dimension> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                dimension: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<dimension
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<dimension as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, dimension,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_upper<Arr, array, dimension> where
        __Derived<array, dimension>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, dimension> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Randomly shuffles the first dimension of the array."]
#[doc = ""]
#[doc = " # Example"]
#[doc = " ```rust,no_run"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_shuffle;"]
#[doc = " #     use diesel::sql_types::{Array, Integer};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let shuffled = diesel::select(array_shuffle::<Array<Integer>, _>(vec![1, 2, 3, 4, 5]))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(5, shuffled.len());"]
#[doc = " assert_eq!(shuffled.iter().sum::<i32>(), 15);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_shuffle<Arr: ArrayOrNullableArray + SingleValue,
    array>(array: array) -> array_shuffle<Arr, array> where
    array: diesel::expression::AsExpression<Arr> {
    array_shuffle_utils::array_shuffle {
        array: array.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_shuffle()`](fn@array_shuffle)"]
pub type array_shuffle<Arr, array> =
    array_shuffle_utils::array_shuffle<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_shuffle_return_type {
    #[doc =
    "Return type of the [`array_shuffle()`](fn@super::array_shuffle) SQL function."]
    pub type array_shuffle<array> =
        super::array_shuffle<<array as
        diesel::expression::Expression>::SqlType, array>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_shuffle_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_shuffle<Arr, array> {
        pub(in super) array: array,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, __Rhs> ::core::ops::Add<__Rhs> for
                array_shuffle<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Sub<__Rhs> for
                array_shuffle<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Mul<__Rhs> for
                array_shuffle<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Div<__Rhs> for
                array_shuffle<Arr, array> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug>
        ::core::fmt::Debug for array_shuffle<Arr, array> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "array_shuffle", "array", &self.array, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone>
        ::core::clone::Clone for array_shuffle<Arr, array> {
        #[inline]
        fn clone(&self) -> array_shuffle<Arr, array> {
            array_shuffle {
                array: ::core::clone::Clone::clone(&self.array),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy>
        ::core::marker::Copy for array_shuffle<Arr, array> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_shuffle<Arr, array> {
                type QueryId =
                    array_shuffle<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <array as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <array as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_shuffle()`](fn@array_shuffle)"]
    pub type HelperType<Arr, array> =
        array_shuffle<Arr, <array as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array> Expression for
        array_shuffle<Arr, array> where (array): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_shuffle<Arr, array>
        where array: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_shuffle<Arr, array> where
        array: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_shuffle<Arr, array> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_shuffle";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array>
        QueryFragment<crate::pg::Pg> for array_shuffle<Arr, array> where
        array: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array>(array);
    const _: () =
        {
            use diesel;
            impl<array, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array> where
                array: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_shuffle<Arr, array> where
        __Derived<array>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns an array of n items randomly selected from array."]
#[doc = " n may not exceed the length of the array."]
#[doc = ""]
#[doc = " # Example"]
#[doc = " ```rust,no_run"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_sample;"]
#[doc = " #     use diesel::sql_types::{Array, Integer, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let vec = vec![1, 2, 3, 4, 5];"]
#[doc =
" let sampled = diesel::select(array_sample::<Array<Integer>, _, _>(vec.clone(), 3))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(3, sampled.len());"]
#[doc = " assert!(sampled.iter().all(|x| vec.contains(x)));"]
#[doc = ""]
#[doc = " let vec: Vec<i32> = Vec::new();"]
#[doc =
" let sampled = diesel::select(array_sample::<Array<Integer>, _, _>(vec, 0))"]
#[doc = "     .get_result::<Vec<i32>>(connection)?;"]
#[doc = " assert_eq!(0, sampled.len());"]
#[doc = ""]
#[doc =
" let sampled = diesel::select(array_sample::<Nullable<Array<Integer>>, _, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = "     1,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<Vec<i32>>>(connection)?;"]
#[doc = " assert!(sampled.is_none());"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_sample<Arr: ArrayOrNullableArray + SingleValue, array,
    n>(array: array, n: n) -> array_sample<Arr, array, n> where
    array: diesel::expression::AsExpression<Arr>,
    n: diesel::expression::AsExpression<Integer> {
    array_sample_utils::array_sample {
        array: array.as_expression(),
        n: n.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_sample()`](fn@array_sample)"]
pub type array_sample<Arr, array, n> =
    array_sample_utils::array_sample<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression,
    <n as diesel::expression::AsExpression<Integer>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_sample_return_type {
    #[doc =
    "Return type of the [`array_sample()`](fn@super::array_sample) SQL function."]
    pub type array_sample<array, n> =
        super::array_sample<<array as
        diesel::expression::Expression>::SqlType, array, n>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_sample_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_sample<Arr, array, n> {
        pub(in super) array: array,
        pub(in super) n: n,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, n, __Rhs> ::core::ops::Add<__Rhs> for
                array_sample<Arr, array, n> 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<Arr, array, n, __Rhs> ::core::ops::Sub<__Rhs> for
                array_sample<Arr, array, n> 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<Arr, array, n, __Rhs> ::core::ops::Mul<__Rhs> for
                array_sample<Arr, array, n> 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<Arr, array, n, __Rhs> ::core::ops::Div<__Rhs> for
                array_sample<Arr, array, n> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug,
        n: ::core::fmt::Debug> ::core::fmt::Debug for
        array_sample<Arr, array, n> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field3_finish(f,
                "array_sample", "array", &self.array, "n", &self.n, "Arr",
                &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone,
        n: ::core::clone::Clone> ::core::clone::Clone for
        array_sample<Arr, array, n> {
        #[inline]
        fn clone(&self) -> array_sample<Arr, array, n> {
            array_sample {
                array: ::core::clone::Clone::clone(&self.array),
                n: ::core::clone::Clone::clone(&self.n),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy,
        n: ::core::marker::Copy> ::core::marker::Copy for
        array_sample<Arr, array, n> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId,
                n: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_sample<Arr, array, n>
                {
                type QueryId =
                    array_sample<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId,
                    <n as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <array as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <n as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <array as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <n as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_sample()`](fn@array_sample)"]
    pub type HelperType<Arr, array, n> =
        array_sample<Arr, <array as AsExpression<Arr>>::Expression,
        <n as AsExpression<Integer>>::Expression>;
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n> Expression for
        array_sample<Arr, array, n> where (array, n): Expression {
        type SqlType = Arr;
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n, __DieselInternal>
        SelectableExpression<__DieselInternal> for array_sample<Arr, array, n>
        where array: SelectableExpression<__DieselInternal>,
        n: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n, __DieselInternal>
        AppearsOnTable<__DieselInternal> for array_sample<Arr, array, n> where
        array: AppearsOnTable<__DieselInternal>,
        n: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n, __DieselInternal>
        FunctionFragment<__DieselInternal> for array_sample<Arr, array, n>
        where __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal>,
        n: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_sample";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.n.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.n.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n>
        QueryFragment<crate::pg::Pg> for array_sample<Arr, array, n> where
        array: QueryFragment<crate::pg::Pg>, n: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array, n>(array, n);
    const _: () =
        {
            use diesel;
            impl<array, n, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array, n> where
                array: diesel::expression::ValidGrouping<__GroupByClause>,
                n: diesel::expression::ValidGrouping<__GroupByClause>,
                <array as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<n
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<n as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr: ArrayOrNullableArray + SingleValue, array, n, __DieselInternal>
        ValidGrouping<__DieselInternal> for array_sample<Arr, array, n> where
        __Derived<array, n>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array, n> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Converts any Array to json."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::array_to_json;"]
#[doc = " #     use diesel::sql_types::{Array, Integer, Text, Nullable};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let json = diesel::select(array_to_json::<Array<Integer>, _>(vec![1, 2, 3, 4, 5]))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = serde_json::json!([1, 2, 3, 4, 5]);"]
#[doc = " assert_eq!(expected, json);"]
#[doc = " let json = diesel::select(array_to_json::<Array<Text>, _>(vec!["]
#[doc = "     \"hello\", \"world\", \"John\", \"Doe\","]
#[doc = " ]))"]
#[doc = " .get_result::<Value>(connection)?;"]
#[doc =
" let expected: Value = serde_json::json!([\"hello\", \"world\", \"John\", \"Doe\"]);"]
#[doc = " assert_eq!(expected, json);"]
#[doc = " let empty: Vec<String> = Vec::new();"]
#[doc =
" let json = diesel::select(array_to_json::<Array<Nullable<Text>>, _>(empty))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " assert_eq!(serde_json::json!([]), json);"]
#[doc =
" let json = diesel::select(array_to_json::<Nullable<Array<Integer>>, _>("]
#[doc = "     None::<Vec<i32>>,"]
#[doc = " ))"]
#[doc = " .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert_eq!(None, json);"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn array_to_json<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>,
    array>(array: array) -> array_to_json<Arr, array> where
    array: diesel::expression::AsExpression<Arr> {
    array_to_json_utils::array_to_json {
        array: array.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`array_to_json()`](fn@array_to_json)"]
pub type array_to_json<Arr, array> =
    array_to_json_utils::array_to_json<Arr,
    <array as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __array_to_json_return_type {
    #[doc =
    "Return type of the [`array_to_json()`](fn@super::array_to_json) SQL function."]
    pub type array_to_json<array> =
        super::array_to_json<<array as
        diesel::expression::Expression>::SqlType, array>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod array_to_json_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct array_to_json<Arr, array> {
        pub(in super) array: array,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, array, __Rhs> ::core::ops::Add<__Rhs> for
                array_to_json<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Sub<__Rhs> for
                array_to_json<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Mul<__Rhs> for
                array_to_json<Arr, array> 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<Arr, array, __Rhs> ::core::ops::Div<__Rhs> for
                array_to_json<Arr, array> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, array: ::core::fmt::Debug>
        ::core::fmt::Debug for array_to_json<Arr, array> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "array_to_json", "array", &self.array, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, array: ::core::clone::Clone>
        ::core::clone::Clone for array_to_json<Arr, array> {
        #[inline]
        fn clone(&self) -> array_to_json<Arr, array> {
            array_to_json {
                array: ::core::clone::Clone::clone(&self.array),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, array: ::core::marker::Copy>
        ::core::marker::Copy for array_to_json<Arr, array> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                array: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for array_to_json<Arr, array> {
                type QueryId =
                    array_to_json<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <array as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <array as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <array as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`array_to_json()`](fn@array_to_json)"]
    pub type HelperType<Arr, array> =
        array_to_json<Arr, <array as AsExpression<Arr>>::Expression>;
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array>
        Expression for array_to_json<Arr, array> where (array): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        array_to_json<Arr, array> where
        array: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        array_to_json<Arr, array> where
        array: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        array_to_json<Arr, array> where
        __DieselInternal: diesel::backend::Backend,
        array: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "array_to_json";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array>
        QueryFragment<crate::pg::Pg> for array_to_json<Arr, array> where
        array: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<array>(array);
    const _: () =
        {
            use diesel;
            impl<array, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<array> where
                array: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>, array,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        array_to_json<Arr, array> where
        __Derived<array>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<array> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Converts any SQL value to json"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::to_json;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc =
" #     use diesel::sql_types::{Integer, Array, Json, Text, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(to_json::<Integer, _>(1)).get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(1), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_json::<Array<Text>, _>(vec![\"abc\", \"xyz\"]))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!([\"abc\", \"xyz\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_json::<Array<Nullable<Text>>, _>(Vec::<String>::new()))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_json::<Nullable<Text>, _>(None::<String>))"]
#[doc = "     .get_result::<Option<Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn to_json<E: MaybeNullableValue<Json>, e>(e: e) -> to_json<E, e> where
    e: diesel::expression::AsExpression<E> {
    to_json_utils::to_json {
        e: e.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`to_json()`](fn@to_json)"]
pub type to_json<E, e> =
    to_json_utils::to_json<E,
    <e as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __to_json_return_type {
    #[doc =
    "Return type of the [`to_json()`](fn@super::to_json) SQL function."]
    pub type to_json<e> =
        super::to_json<<e as diesel::expression::Expression>::SqlType, e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod to_json_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct to_json<E, e> {
        pub(in super) e: e,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, e, __Rhs> ::core::ops::Add<__Rhs> for to_json<E, e> 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<E, e, __Rhs> ::core::ops::Sub<__Rhs> for to_json<E, e> 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<E, e, __Rhs> ::core::ops::Mul<__Rhs> for to_json<E, e> 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<E, e, __Rhs> ::core::ops::Div<__Rhs> for to_json<E, e> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        to_json<E, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "to_json",
                "e", &self.e, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, e: ::core::clone::Clone>
        ::core::clone::Clone for to_json<E, e> {
        #[inline]
        fn clone(&self) -> to_json<E, e> {
            to_json {
                e: ::core::clone::Clone::clone(&self.e),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, e: ::core::marker::Copy>
        ::core::marker::Copy for to_json<E, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for to_json<E, e> {
                type QueryId =
                    to_json<<E as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`to_json()`](fn@to_json)"]
    pub type HelperType<E, e> =
        to_json<E, <e as AsExpression<E>>::Expression>;
    impl<E: MaybeNullableValue<Json>, e> Expression for to_json<E, e> where
        (e): Expression {
        type SqlType = E::Out;
    }
    impl<E: MaybeNullableValue<Json>, e, __DieselInternal>
        SelectableExpression<__DieselInternal> for to_json<E, e> where
        e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: MaybeNullableValue<Json>, e, __DieselInternal>
        AppearsOnTable<__DieselInternal> for to_json<E, e> where
        e: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: MaybeNullableValue<Json>, e, __DieselInternal>
        FunctionFragment<__DieselInternal> for to_json<E, e> where
        __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "to_json";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: MaybeNullableValue<Json>, e> QueryFragment<crate::pg::Pg> for
        to_json<E, e> where e: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e>(e);
    const _: () =
        {
            use diesel;
            impl<e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e> where
                e: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: MaybeNullableValue<Json>, e, __DieselInternal>
        ValidGrouping<__DieselInternal> for to_json<E, e> where
        __Derived<e>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Converts any SQL value to jsonb"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::to_jsonb;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc =
" #     use diesel::sql_types::{Integer, Array, Jsonb, Text, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(to_jsonb::<Integer, _>(1)).get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(1), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_jsonb::<Array<Text>, _>(vec![\"abc\", \"def\"]))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!([\"abc\", \"def\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_jsonb::<Array<Nullable<Text>>, _>(Vec::<String>::new()))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(to_jsonb::<Nullable<Text>, _>(None::<String>))"]
#[doc = "     .get_result::<Option<Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn to_jsonb<E: MaybeNullableValue<Jsonb>, e>(e: e) -> to_jsonb<E, e> where
    e: diesel::expression::AsExpression<E> {
    to_jsonb_utils::to_jsonb {
        e: e.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`to_jsonb()`](fn@to_jsonb)"]
pub type to_jsonb<E, e> =
    to_jsonb_utils::to_jsonb<E,
    <e as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __to_jsonb_return_type {
    #[doc =
    "Return type of the [`to_jsonb()`](fn@super::to_jsonb) SQL function."]
    pub type to_jsonb<e> =
        super::to_jsonb<<e as diesel::expression::Expression>::SqlType, e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod to_jsonb_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct to_jsonb<E, e> {
        pub(in super) e: e,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, e, __Rhs> ::core::ops::Add<__Rhs> for to_jsonb<E, e> 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<E, e, __Rhs> ::core::ops::Sub<__Rhs> for to_jsonb<E, e> 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<E, e, __Rhs> ::core::ops::Mul<__Rhs> for to_jsonb<E, e> 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<E, e, __Rhs> ::core::ops::Div<__Rhs> for to_jsonb<E, e> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        to_jsonb<E, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f, "to_jsonb",
                "e", &self.e, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, e: ::core::clone::Clone>
        ::core::clone::Clone for to_jsonb<E, e> {
        #[inline]
        fn clone(&self) -> to_jsonb<E, e> {
            to_jsonb {
                e: ::core::clone::Clone::clone(&self.e),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, e: ::core::marker::Copy>
        ::core::marker::Copy for to_jsonb<E, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for to_jsonb<E, e> {
                type QueryId =
                    to_jsonb<<E as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`to_jsonb()`](fn@to_jsonb)"]
    pub type HelperType<E, e> =
        to_jsonb<E, <e as AsExpression<E>>::Expression>;
    impl<E: MaybeNullableValue<Jsonb>, e> Expression for to_jsonb<E, e> where
        (e): Expression {
        type SqlType = E::Out;
    }
    impl<E: MaybeNullableValue<Jsonb>, e, __DieselInternal>
        SelectableExpression<__DieselInternal> for to_jsonb<E, e> where
        e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: MaybeNullableValue<Jsonb>, e, __DieselInternal>
        AppearsOnTable<__DieselInternal> for to_jsonb<E, e> where
        e: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: MaybeNullableValue<Jsonb>, e, __DieselInternal>
        FunctionFragment<__DieselInternal> for to_jsonb<E, e> where
        __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "to_jsonb";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: MaybeNullableValue<Jsonb>, e> QueryFragment<crate::pg::Pg> for
        to_jsonb<E, e> where e: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e>(e);
    const _: () =
        {
            use diesel;
            impl<e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e> where
                e: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: MaybeNullableValue<Jsonb>, e, __DieselInternal>
        ValidGrouping<__DieselInternal> for to_jsonb<E, e> where
        __Derived<e>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a JSON object out of a text array. The array must have an even number of members,"]
#[doc = " in which case they are taken as alternating key/value pairs"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_object;"]
#[doc = " #     use diesel::sql_types::{Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let json = diesel::select(json_object::<Array<Text>,_>(vec![\"hello\",\"world\"]))"]
#[doc = "                 .get_result::<Value>(connection)?;"]
#[doc = " let expected:Value = serde_json::json!({\"hello\":\"world\"});"]
#[doc = " assert_eq!(expected,json);"]
#[doc = ""]
#[doc =
" let json = diesel::select(json_object::<Array<Text>,_>(vec![\"hello\",\"world\",\"John\",\"Doe\"]))"]
#[doc = "                 .get_result::<Value>(connection)?;"]
#[doc =
" let expected:Value = serde_json::json!({\"hello\":\"world\",\"John\":\"Doe\"});"]
#[doc = " assert_eq!(expected,json);"]
#[doc = ""]
#[doc =
" let json = diesel::select(json_object::<Array<Text>,_>(vec![\"hello\",\"world\",\"John\"]))"]
#[doc = "                 .get_result::<Value>(connection);"]
#[doc = " assert!(json.is_err());"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let json = diesel::select(json_object::<Array<Nullable<Text>>,_>(empty))"]
#[doc = "                 .get_result::<Value>(connection);"]
#[doc = " assert!(json.is_err());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_object<Arr: TextArrayOrNullableTextArray +
    MaybeNullableValue<Json>, text_array>(text_array: text_array)
    -> json_object<Arr, text_array> where
    text_array: diesel::expression::AsExpression<Arr> {
    json_object_utils::json_object {
        text_array: text_array.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_object()`](fn@json_object)"]
pub type json_object<Arr, text_array> =
    json_object_utils::json_object<Arr,
    <text_array as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_object_return_type {
    #[doc =
    "Return type of the [`json_object()`](fn@super::json_object) SQL function."]
    pub type json_object<text_array> =
        super::json_object<<text_array as
        diesel::expression::Expression>::SqlType, text_array>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_object_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_object<Arr, text_array> {
        pub(in super) text_array: text_array,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, text_array, __Rhs> ::core::ops::Add<__Rhs> for
                json_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Sub<__Rhs> for
                json_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Mul<__Rhs> for
                json_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Div<__Rhs> for
                json_object<Arr, text_array> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, text_array: ::core::fmt::Debug>
        ::core::fmt::Debug for json_object<Arr, text_array> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "json_object", "text_array", &self.text_array, "Arr",
                &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, text_array: ::core::clone::Clone>
        ::core::clone::Clone for json_object<Arr, text_array> {
        #[inline]
        fn clone(&self) -> json_object<Arr, text_array> {
            json_object {
                text_array: ::core::clone::Clone::clone(&self.text_array),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, text_array: ::core::marker::Copy>
        ::core::marker::Copy for json_object<Arr, text_array> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                text_array: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_object<Arr, text_array> {
                type QueryId =
                    json_object<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <text_array as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <text_array as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_array as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`json_object()`](fn@json_object)"]
    pub type HelperType<Arr, text_array> =
        json_object<Arr, <text_array as AsExpression<Arr>>::Expression>;
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array> Expression for json_object<Arr, text_array> where
        (text_array): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array, __DieselInternal> SelectableExpression<__DieselInternal>
        for json_object<Arr, text_array> where
        text_array: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array, __DieselInternal> AppearsOnTable<__DieselInternal> for
        json_object<Arr, text_array> where
        text_array: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array, __DieselInternal> FunctionFragment<__DieselInternal> for
        json_object<Arr, text_array> where
        __DieselInternal: diesel::backend::Backend,
        text_array: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_object";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.text_array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array> QueryFragment<crate::pg::Pg> for
        json_object<Arr, text_array> where
        text_array: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<text_array>(text_array);
    const _: () =
        {
            use diesel;
            impl<text_array, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<text_array> where
                text_array: diesel::expression::ValidGrouping<__GroupByClause>
                {
                type IsAggregate =
                    <text_array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>,
        text_array, __DieselInternal> ValidGrouping<__DieselInternal> for
        json_object<Arr, text_array> where
        __Derived<text_array>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<text_array> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" This form of json_object takes keys and values pairwise from two separate arrays."]
#[doc = " In all other respects it is identical to the one-argument form."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_object_with_keys_and_values;"]
#[doc = " #     use diesel::sql_types::{Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let json = diesel::select(json_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>("]
#[doc = "             vec![\"hello\",\"John\"],vec![\"world\",\"Doe\"]))"]
#[doc = "             .get_result::<Value>(connection)?;"]
#[doc =
" let expected:Value = serde_json::json!({\"hello\":\"world\",\"John\":\"Doe\"});"]
#[doc = " assert_eq!(expected,json);"]
#[doc = ""]
#[doc =
" let json = diesel::select(json_object_with_keys_and_values::<Nullable<Array<Text>>, Nullable<Array<Text>>, _, _>("]
#[doc = "             Some(vec![\"hello\",\"John\"]), None::<Vec<String>>))"]
#[doc = "             .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert_eq!(None::<Value>,json);"]
#[doc = ""]
#[doc = " let empty: Vec<String> = Vec::new();"]
#[doc =
" let json = diesel::select(json_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>("]
#[doc = "             vec![\"hello\",\"John\"], empty))"]
#[doc = "             .get_result::<Value>(connection);"]
#[doc = " assert!(json.is_err());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_object_with_keys_and_values<Arr1: TextArrayOrNullableTextArray +
    SingleValue, Arr2: TextArrayOrNullableTextArray +
    CombinedNullableValue<Arr1, Json>, keys,
    values>(keys: keys, values: values)
    -> json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
    keys: diesel::expression::AsExpression<Arr1>,
    values: diesel::expression::AsExpression<Arr2> {
    json_object_with_keys_and_values_utils::json_object_with_keys_and_values {
        keys: keys.as_expression(),
        values: values.as_expression(),
        Arr1: ::core::marker::PhantomData,
        Arr2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_object_with_keys_and_values()`](fn@json_object_with_keys_and_values)"]
pub type json_object_with_keys_and_values<Arr1, Arr2, keys, values> =
    json_object_with_keys_and_values_utils::json_object_with_keys_and_values<Arr1,
    Arr2, <keys as diesel::expression::AsExpression<Arr1>>::Expression,
    <values as diesel::expression::AsExpression<Arr2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_object_with_keys_and_values_return_type {
    #[doc =
    "Return type of the [`json_object_with_keys_and_values()`](fn@super::json_object_with_keys_and_values) SQL function."]
    pub type json_object_with_keys_and_values<keys, values> =
        super::json_object_with_keys_and_values<<keys as
        diesel::expression::Expression>::SqlType,
        <values as diesel::expression::Expression>::SqlType, keys, values>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_object_with_keys_and_values_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        pub(in super) keys: keys,
        pub(in super) values: values,
        pub(in super) Arr1: ::core::marker::PhantomData<Arr1>,
        pub(in super) Arr2: ::core::marker::PhantomData<Arr2>,
    }
    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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Add<__Rhs> for
                json_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Sub<__Rhs> for
                json_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Mul<__Rhs> for
                json_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Div<__Rhs> for
                json_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr1: ::core::fmt::Debug, Arr2: ::core::fmt::Debug,
        keys: ::core::fmt::Debug, values: ::core::fmt::Debug>
        ::core::fmt::Debug for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "json_object_with_keys_and_values", "keys", &self.keys,
                "values", &self.values, "Arr1", &self.Arr1, "Arr2",
                &&self.Arr2)
        }
    }
    #[automatically_derived]
    impl<Arr1: ::core::clone::Clone, Arr2: ::core::clone::Clone,
        keys: ::core::clone::Clone, values: ::core::clone::Clone>
        ::core::clone::Clone for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        #[inline]
        fn clone(&self)
            -> json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
            json_object_with_keys_and_values {
                keys: ::core::clone::Clone::clone(&self.keys),
                values: ::core::clone::Clone::clone(&self.values),
                Arr1: ::core::clone::Clone::clone(&self.Arr1),
                Arr2: ::core::clone::Clone::clone(&self.Arr2),
            }
        }
    }
    #[automatically_derived]
    impl<Arr1: ::core::marker::Copy, Arr2: ::core::marker::Copy,
        keys: ::core::marker::Copy, values: ::core::marker::Copy>
        ::core::marker::Copy for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr1: diesel::query_builder::QueryId,
                Arr2: diesel::query_builder::QueryId,
                keys: diesel::query_builder::QueryId,
                values: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_object_with_keys_and_values<Arr1, Arr2, keys, values> {
                type QueryId =
                    json_object_with_keys_and_values<<Arr1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr2 as diesel::query_builder::QueryId>::QueryId,
                    <keys as diesel::query_builder::QueryId>::QueryId,
                    <values as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr1 as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                    <Arr2 as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <keys as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <values as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <Arr2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <keys as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <values as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_object_with_keys_and_values()`](fn@json_object_with_keys_and_values)"]
    pub type HelperType<Arr1, Arr2, keys, values> =
        json_object_with_keys_and_values<Arr1, Arr2,
        <keys as AsExpression<Arr1>>::Expression,
        <values as AsExpression<Arr2>>::Expression>;
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values> Expression for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        (keys, values): Expression {
        type SqlType = Arr2::Out;
    }
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: SelectableExpression<__DieselInternal>,
        values: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: AppearsOnTable<__DieselInternal>,
        values: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        __DieselInternal: diesel::backend::Backend,
        keys: QueryFragment<__DieselInternal>,
        values: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_object";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.keys.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.keys.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.values.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.values.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values>
        QueryFragment<crate::pg::Pg> for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: QueryFragment<crate::pg::Pg>,
        values: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<keys, values>(keys, values);
    const _: () =
        {
            use diesel;
            impl<keys, values, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<keys, values> where
                keys: diesel::expression::ValidGrouping<__GroupByClause>,
                values: diesel::expression::ValidGrouping<__GroupByClause>,
                <keys as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<values
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<keys as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<values as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Json>, keys, values, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        json_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        __Derived<keys, values>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<keys, values> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the type of the top-level json value as a text-string"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_typeof;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     use diesel::sql_types::{Json, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(json_typeof::<Json, _>(json!({\"a\": \"b\", \"c\": 1})))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"object\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_typeof::<Json, _>(json!([1,2,3])))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"array\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_typeof::<Json, _>(json!(\"abc\")))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"string\".to_string(), result);"]
#[doc = ""]
#[doc = " let result = diesel::select(json_typeof::<Json, _>(json!(-123.4)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"number\".to_string(), result);"]
#[doc = ""]
#[doc = " let result = diesel::select(json_typeof::<Json, _>(json!(true)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"boolean\".to_string(), result);"]
#[doc = ""]
#[doc = " let result = diesel::select(json_typeof::<Json, _>(json!(null)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"null\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_typeof::<Nullable<Json>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert!(result.is_none());"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_typeof<E: JsonOrNullableJson + SingleValue +
    MaybeNullableValue<Text>, e>(e: e) -> json_typeof<E, e> where
    e: diesel::expression::AsExpression<E> {
    json_typeof_utils::json_typeof {
        e: e.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_typeof()`](fn@json_typeof)"]
pub type json_typeof<E, e> =
    json_typeof_utils::json_typeof<E,
    <e as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_typeof_return_type {
    #[doc =
    "Return type of the [`json_typeof()`](fn@super::json_typeof) SQL function."]
    pub type json_typeof<e> =
        super::json_typeof<<e as diesel::expression::Expression>::SqlType, e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_typeof_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_typeof<E, e> {
        pub(in super) e: e,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, e, __Rhs> ::core::ops::Add<__Rhs> for json_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Sub<__Rhs> for json_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Mul<__Rhs> for json_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Div<__Rhs> for json_typeof<E, e>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        json_typeof<E, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "json_typeof", "e", &self.e, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, e: ::core::clone::Clone>
        ::core::clone::Clone for json_typeof<E, e> {
        #[inline]
        fn clone(&self) -> json_typeof<E, e> {
            json_typeof {
                e: ::core::clone::Clone::clone(&self.e),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, e: ::core::marker::Copy>
        ::core::marker::Copy for json_typeof<E, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for json_typeof<E, e> {
                type QueryId =
                    json_typeof<<E as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`json_typeof()`](fn@json_typeof)"]
    pub type HelperType<E, e> =
        json_typeof<E, <e as AsExpression<E>>::Expression>;
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e>
        Expression for json_typeof<E, e> where (e): Expression {
        type SqlType = E::Out;
    }
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        json_typeof<E, e> where e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        json_typeof<E, e> where e: AppearsOnTable<__DieselInternal>,
        Self: Expression {}
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        json_typeof<E, e> where __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_typeof";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e>
        QueryFragment<crate::pg::Pg> for json_typeof<E, e> where
        e: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e>(e);
    const _: () =
        {
            use diesel;
            impl<e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e> where
                e: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        json_typeof<E, e> where __Derived<e>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the type of the top-level jsonb value as a text-string"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_typeof;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!({\"a\": \"b\", \"c\": 1})))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"object\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!([1,2,3])))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"array\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(\"abc\")))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"string\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(-123.4)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"number\".to_string(), result);"]
#[doc = ""]
#[doc = " let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(true)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"boolean\".to_string(), result);"]
#[doc = ""]
#[doc = " let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(null)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(\"null\".to_string(), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_typeof::<Nullable<Jsonb>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert!(result.is_none());"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_typeof<E: JsonbOrNullableJsonb + SingleValue +
    MaybeNullableValue<Text>, e>(e: e) -> jsonb_typeof<E, e> where
    e: diesel::expression::AsExpression<E> {
    jsonb_typeof_utils::jsonb_typeof {
        e: e.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_typeof()`](fn@jsonb_typeof)"]
pub type jsonb_typeof<E, e> =
    jsonb_typeof_utils::jsonb_typeof<E,
    <e as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_typeof_return_type {
    #[doc =
    "Return type of the [`jsonb_typeof()`](fn@super::jsonb_typeof) SQL function."]
    pub type jsonb_typeof<e> =
        super::jsonb_typeof<<e as diesel::expression::Expression>::SqlType,
        e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_typeof_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_typeof<E, e> {
        pub(in super) e: e,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, e, __Rhs> ::core::ops::Add<__Rhs> for jsonb_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Sub<__Rhs> for jsonb_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Mul<__Rhs> for jsonb_typeof<E, e>
                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<E, e, __Rhs> ::core::ops::Div<__Rhs> for jsonb_typeof<E, e>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        jsonb_typeof<E, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_typeof", "e", &self.e, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, e: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_typeof<E, e> {
        #[inline]
        fn clone(&self) -> jsonb_typeof<E, e> {
            jsonb_typeof {
                e: ::core::clone::Clone::clone(&self.e),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, e: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_typeof<E, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for jsonb_typeof<E, e> {
                type QueryId =
                    jsonb_typeof<<E as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_typeof()`](fn@jsonb_typeof)"]
    pub type HelperType<E, e> =
        jsonb_typeof<E, <e as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e>
        Expression for jsonb_typeof<E, e> where (e): Expression {
        type SqlType = E::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_typeof<E, e> where e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_typeof<E, e> where e: AppearsOnTable<__DieselInternal>,
        Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_typeof<E, e> where __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_typeof";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e>
        QueryFragment<crate::pg::Pg> for jsonb_typeof<E, e> where
        e: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e>(e);
    const _: () =
        {
            use diesel;
            impl<e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e> where
                e: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_typeof<E, e> where __Derived<e>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Converts the given json value to pretty-printed, indented text"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_pretty;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!([{\"f1\":1,\"f2\":null},2,null,3])))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"["]
#[doc = "     {"]
#[doc = "         \"f1\": 1,"]
#[doc = "         \"f2\": null"]
#[doc = "     },"]
#[doc = "     2,"]
#[doc = "     null,"]
#[doc = "     3"]
#[doc = " ]\"#, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!({\"a\": 1, \"b\": \"cd\"})))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"{"]
#[doc = "     \"a\": 1,"]
#[doc = "     \"b\": \"cd\""]
#[doc = " }\"#, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(\"abc\")))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"\"abc\"\"#, result);"]
#[doc = ""]
#[doc = " let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(22)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"22\"#, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(false)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"false\"#, result);"]
#[doc = ""]
#[doc = " let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(null)))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"null\"#, result);"]
#[doc = ""]
#[doc = " let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!({})))"]
#[doc = "     .get_result::<String>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(r#\"{"]
#[doc = " }\"#, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_pretty::<Nullable<Jsonb>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert!(result.is_none());"]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_pretty<E: JsonbOrNullableJsonb + SingleValue +
    MaybeNullableValue<Text>, e>(e: e) -> jsonb_pretty<E, e> where
    e: diesel::expression::AsExpression<E> {
    jsonb_pretty_utils::jsonb_pretty {
        e: e.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_pretty()`](fn@jsonb_pretty)"]
pub type jsonb_pretty<E, e> =
    jsonb_pretty_utils::jsonb_pretty<E,
    <e as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_pretty_return_type {
    #[doc =
    "Return type of the [`jsonb_pretty()`](fn@super::jsonb_pretty) SQL function."]
    pub type jsonb_pretty<e> =
        super::jsonb_pretty<<e as diesel::expression::Expression>::SqlType,
        e>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_pretty_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_pretty<E, e> {
        pub(in super) e: e,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, e, __Rhs> ::core::ops::Add<__Rhs> for jsonb_pretty<E, e>
                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<E, e, __Rhs> ::core::ops::Sub<__Rhs> for jsonb_pretty<E, e>
                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<E, e, __Rhs> ::core::ops::Mul<__Rhs> for jsonb_pretty<E, e>
                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<E, e, __Rhs> ::core::ops::Div<__Rhs> for jsonb_pretty<E, e>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, e: ::core::fmt::Debug> ::core::fmt::Debug for
        jsonb_pretty<E, e> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_pretty", "e", &self.e, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, e: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_pretty<E, e> {
        #[inline]
        fn clone(&self) -> jsonb_pretty<E, e> {
            jsonb_pretty {
                e: ::core::clone::Clone::clone(&self.e),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, e: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_pretty<E, e> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                e: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for jsonb_pretty<E, e> {
                type QueryId =
                    jsonb_pretty<<E as diesel::query_builder::QueryId>::QueryId,
                    <e as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <e as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        && true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <e as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_pretty()`](fn@jsonb_pretty)"]
    pub type HelperType<E, e> =
        jsonb_pretty<E, <e as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e>
        Expression for jsonb_pretty<E, e> where (e): Expression {
        type SqlType = E::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_pretty<E, e> where e: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_pretty<E, e> where e: AppearsOnTable<__DieselInternal>,
        Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_pretty<E, e> where __DieselInternal: diesel::backend::Backend,
        e: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_pretty";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.e.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.e.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e>
        QueryFragment<crate::pg::Pg> for jsonb_pretty<E, e> where
        e: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<e>(e);
    const _: () =
        {
            use diesel;
            impl<e, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<e> where
                e: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <e as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>, e,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_pretty<E, e> where __Derived<e>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<e> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Deletes all object fields that have null values from the given JSON value, recursively."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_strip_nulls;"]
#[doc = " #     use diesel::sql_types::{Json, Nullable};"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_strip_nulls::<Json, _>(json!({\"hello\": null})))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!({});"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_strip_nulls::<Json, _>(json!([{\"f1\":1, \"f2\":null}, 2, null, 3])))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!([{\"f1\":1}, 2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_strip_nulls::<Nullable<Json>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_strip_nulls::<Json, _>(json!(null)))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected = json!(null);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_strip_nulls<E: JsonOrNullableJson + SingleValue, json>(json: json)
    -> json_strip_nulls<E, json> where
    json: diesel::expression::AsExpression<E> {
    json_strip_nulls_utils::json_strip_nulls {
        json: json.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_strip_nulls()`](fn@json_strip_nulls)"]
pub type json_strip_nulls<E, json> =
    json_strip_nulls_utils::json_strip_nulls<E,
    <json as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_strip_nulls_return_type {
    #[doc =
    "Return type of the [`json_strip_nulls()`](fn@super::json_strip_nulls) SQL function."]
    pub type json_strip_nulls<json> =
        super::json_strip_nulls<<json as
        diesel::expression::Expression>::SqlType, json>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_strip_nulls_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_strip_nulls<E, json> {
        pub(in super) json: json,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, json, __Rhs> ::core::ops::Add<__Rhs> for
                json_strip_nulls<E, json> 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<E, json, __Rhs> ::core::ops::Sub<__Rhs> for
                json_strip_nulls<E, json> 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<E, json, __Rhs> ::core::ops::Mul<__Rhs> for
                json_strip_nulls<E, json> 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<E, json, __Rhs> ::core::ops::Div<__Rhs> for
                json_strip_nulls<E, json> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, json: ::core::fmt::Debug> ::core::fmt::Debug
        for json_strip_nulls<E, json> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "json_strip_nulls", "json", &self.json, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, json: ::core::clone::Clone>
        ::core::clone::Clone for json_strip_nulls<E, json> {
        #[inline]
        fn clone(&self) -> json_strip_nulls<E, json> {
            json_strip_nulls {
                json: ::core::clone::Clone::clone(&self.json),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, json: ::core::marker::Copy>
        ::core::marker::Copy for json_strip_nulls<E, json> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for json_strip_nulls<E, json> {
                type QueryId =
                    json_strip_nulls<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <json as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc = "The return type of [`json_strip_nulls()`](fn@json_strip_nulls)"]
    pub type HelperType<E, json> =
        json_strip_nulls<E, <json as AsExpression<E>>::Expression>;
    impl<E: JsonOrNullableJson + SingleValue, json> Expression for
        json_strip_nulls<E, json> where (json): Expression {
        type SqlType = E;
    }
    impl<E: JsonOrNullableJson + SingleValue, json, __DieselInternal>
        SelectableExpression<__DieselInternal> for json_strip_nulls<E, json>
        where json: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonOrNullableJson + SingleValue, json, __DieselInternal>
        AppearsOnTable<__DieselInternal> for json_strip_nulls<E, json> where
        json: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonOrNullableJson + SingleValue, json, __DieselInternal>
        FunctionFragment<__DieselInternal> for json_strip_nulls<E, json> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_strip_nulls";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonOrNullableJson + SingleValue, json>
        QueryFragment<crate::pg::Pg> for json_strip_nulls<E, json> where
        json: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json>(json);
    const _: () =
        {
            use diesel;
            impl<json, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json> where
                json: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonOrNullableJson + SingleValue, json, __DieselInternal>
        ValidGrouping<__DieselInternal> for json_strip_nulls<E, json> where
        __Derived<json>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Deletes all object fields that have null values from the given JSON value, recursively."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_strip_nulls;"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable};"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!({\"hello\": null})))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!({});"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!([{\"f1\":1, \"f2\":null}, 2, null, 3])))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!([{\"f1\":1}, 2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_strip_nulls::<Nullable<Jsonb>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!(null)))"]
#[doc = "     .get_result::<Value>(connection)?;"]
#[doc = " let expected = json!(null);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = ""]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_strip_nulls<E: JsonbOrNullableJsonb + SingleValue,
    jsonb>(jsonb: jsonb) -> jsonb_strip_nulls<E, jsonb> where
    jsonb: diesel::expression::AsExpression<E> {
    jsonb_strip_nulls_utils::jsonb_strip_nulls {
        jsonb: jsonb.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_strip_nulls()`](fn@jsonb_strip_nulls)"]
pub type jsonb_strip_nulls<E, jsonb> =
    jsonb_strip_nulls_utils::jsonb_strip_nulls<E,
    <jsonb as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_strip_nulls_return_type {
    #[doc =
    "Return type of the [`jsonb_strip_nulls()`](fn@super::jsonb_strip_nulls) SQL function."]
    pub type jsonb_strip_nulls<jsonb> =
        super::jsonb_strip_nulls<<jsonb as
        diesel::expression::Expression>::SqlType, jsonb>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_strip_nulls_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_strip_nulls<E, jsonb> {
        pub(in super) jsonb: jsonb,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, jsonb, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_strip_nulls<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_strip_nulls<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_strip_nulls<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_strip_nulls<E, jsonb> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, jsonb: ::core::fmt::Debug> ::core::fmt::Debug
        for jsonb_strip_nulls<E, jsonb> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_strip_nulls", "jsonb", &self.jsonb, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, jsonb: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_strip_nulls<E, jsonb> {
        #[inline]
        fn clone(&self) -> jsonb_strip_nulls<E, jsonb> {
            jsonb_strip_nulls {
                jsonb: ::core::clone::Clone::clone(&self.jsonb),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, jsonb: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_strip_nulls<E, jsonb> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                jsonb: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for jsonb_strip_nulls<E, jsonb>
                {
                type QueryId =
                    jsonb_strip_nulls<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <jsonb as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <jsonb as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <jsonb as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_strip_nulls()`](fn@jsonb_strip_nulls)"]
    pub type HelperType<E, jsonb> =
        jsonb_strip_nulls<E, <jsonb as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb> Expression for
        jsonb_strip_nulls<E, jsonb> where (jsonb): Expression {
        type SqlType = E;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb, __DieselInternal>
        SelectableExpression<__DieselInternal> for jsonb_strip_nulls<E, jsonb>
        where jsonb: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb, __DieselInternal>
        AppearsOnTable<__DieselInternal> for jsonb_strip_nulls<E, jsonb> where
        jsonb: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb, __DieselInternal>
        FunctionFragment<__DieselInternal> for jsonb_strip_nulls<E, jsonb>
        where __DieselInternal: diesel::backend::Backend,
        jsonb: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_strip_nulls";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.jsonb.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.jsonb.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb>
        QueryFragment<crate::pg::Pg> for jsonb_strip_nulls<E, jsonb> where
        jsonb: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<jsonb>(jsonb);
    const _: () =
        {
            use diesel;
            impl<jsonb, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<jsonb> where
                jsonb: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <jsonb as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue, jsonb, __DieselInternal>
        ValidGrouping<__DieselInternal> for jsonb_strip_nulls<E, jsonb> where
        __Derived<jsonb>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<jsonb> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the number of elements in the top-level JSON array"]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_array_length;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     use diesel::sql_types::{Integer, Json, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_array_length::<Json, _>(json!([1, 2, 3])))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(result, 3);"]
#[doc = ""]
#[doc = " let result ="]
#[doc =
"     diesel::select(json_array_length::<Json, _>(json!([]))).get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(result, 0);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_array_length::<Nullable<Json>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_array_length<E: JsonOrNullableJson + MaybeNullableValue<Integer>,
    json>(json: json) -> json_array_length<E, json> where
    json: diesel::expression::AsExpression<E> {
    json_array_length_utils::json_array_length {
        json: json.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_array_length()`](fn@json_array_length)"]
pub type json_array_length<E, json> =
    json_array_length_utils::json_array_length<E,
    <json as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_array_length_return_type {
    #[doc =
    "Return type of the [`json_array_length()`](fn@super::json_array_length) SQL function."]
    pub type json_array_length<json> =
        super::json_array_length<<json as
        diesel::expression::Expression>::SqlType, json>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_array_length_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_array_length<E, json> {
        pub(in super) json: json,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, json, __Rhs> ::core::ops::Add<__Rhs> for
                json_array_length<E, json> 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<E, json, __Rhs> ::core::ops::Sub<__Rhs> for
                json_array_length<E, json> 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<E, json, __Rhs> ::core::ops::Mul<__Rhs> for
                json_array_length<E, json> 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<E, json, __Rhs> ::core::ops::Div<__Rhs> for
                json_array_length<E, json> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, json: ::core::fmt::Debug> ::core::fmt::Debug
        for json_array_length<E, json> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "json_array_length", "json", &self.json, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, json: ::core::clone::Clone>
        ::core::clone::Clone for json_array_length<E, json> {
        #[inline]
        fn clone(&self) -> json_array_length<E, json> {
            json_array_length {
                json: ::core::clone::Clone::clone(&self.json),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, json: ::core::marker::Copy>
        ::core::marker::Copy for json_array_length<E, json> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for json_array_length<E, json>
                {
                type QueryId =
                    json_array_length<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <json as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        || false;
            }
        };
    #[doc =
    "The return type of [`json_array_length()`](fn@json_array_length)"]
    pub type HelperType<E, json> =
        json_array_length<E, <json as AsExpression<E>>::Expression>;
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json> Expression
        for json_array_length<E, json> where (json): Expression {
        type SqlType = E::Out;
    }
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        json_array_length<E, json> where
        json: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        json_array_length<E, json> where
        json: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        json_array_length<E, json> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_array_length";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json>
        QueryFragment<crate::pg::Pg> for json_array_length<E, json> where
        json: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json>(json);
    const _: () =
        {
            use diesel;
            impl<json, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json> where
                json: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonOrNullableJson + MaybeNullableValue<Integer>, json,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        json_array_length<E, json> where
        __Derived<json>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns the number of elements in the top-level JSON array"]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_array_length;"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     use diesel::sql_types::{Integer, Jsonb, Nullable};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_array_length::<Jsonb, _>(json!([1, 2, 3])))"]
#[doc = "     .get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(result, 3);"]
#[doc = ""]
#[doc = " let result ="]
#[doc =
"     diesel::select(jsonb_array_length::<Jsonb, _>(json!([]))).get_result::<i32>(connection)?;"]
#[doc = " assert_eq!(result, 0);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_array_length::<Nullable<Jsonb>, _>(None::<Value>))"]
#[doc = "     .get_result::<Option<i32>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_array_length<E: JsonbOrNullableJsonb +
    MaybeNullableValue<Integer>, jsonb>(jsonb: jsonb)
    -> jsonb_array_length<E, jsonb> where
    jsonb: diesel::expression::AsExpression<E> {
    jsonb_array_length_utils::jsonb_array_length {
        jsonb: jsonb.as_expression(),
        E: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_array_length()`](fn@jsonb_array_length)"]
pub type jsonb_array_length<E, jsonb> =
    jsonb_array_length_utils::jsonb_array_length<E,
    <jsonb as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_array_length_return_type {
    #[doc =
    "Return type of the [`jsonb_array_length()`](fn@super::jsonb_array_length) SQL function."]
    pub type jsonb_array_length<jsonb> =
        super::jsonb_array_length<<jsonb as
        diesel::expression::Expression>::SqlType, jsonb>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_array_length_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_array_length<E, jsonb> {
        pub(in super) jsonb: jsonb,
        pub(in super) E: ::core::marker::PhantomData<E>,
    }
    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<E, jsonb, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_array_length<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_array_length<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_array_length<E, jsonb> 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<E, jsonb, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_array_length<E, jsonb> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, jsonb: ::core::fmt::Debug> ::core::fmt::Debug
        for jsonb_array_length<E, jsonb> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_array_length", "jsonb", &self.jsonb, "E", &&self.E)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, jsonb: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_array_length<E, jsonb> {
        #[inline]
        fn clone(&self) -> jsonb_array_length<E, jsonb> {
            jsonb_array_length {
                jsonb: ::core::clone::Clone::clone(&self.jsonb),
                E: ::core::clone::Clone::clone(&self.E),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, jsonb: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_array_length<E, jsonb> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                jsonb: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_array_length<E, jsonb> {
                type QueryId =
                    jsonb_array_length<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <jsonb as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <jsonb as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <jsonb as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_array_length()`](fn@jsonb_array_length)"]
    pub type HelperType<E, jsonb> =
        jsonb_array_length<E, <jsonb as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb>
        Expression for jsonb_array_length<E, jsonb> where (jsonb): Expression
        {
        type SqlType = E::Out;
    }
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_array_length<E, jsonb> where
        jsonb: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_array_length<E, jsonb> where
        jsonb: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_array_length<E, jsonb> where
        __DieselInternal: diesel::backend::Backend,
        jsonb: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_array_length";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.jsonb.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.jsonb.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb>
        QueryFragment<crate::pg::Pg> for jsonb_array_length<E, jsonb> where
        jsonb: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<jsonb>(jsonb);
    const _: () =
        {
            use diesel;
            impl<jsonb, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<jsonb> where
                jsonb: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <jsonb as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>, jsonb,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_array_length<E, jsonb> where
        __Derived<jsonb>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<jsonb> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a JSON object out of a text array. The array must have an even number of members,"]
#[doc =
" in which case they are taken as alternating key/value pairs. This function also has a form that"]
#[doc = " that takes keys and values as separate text array arguments."]
#[doc =
" See [jsonb_object_with_keys_and_values](jsonb_object_with_keys_and_values())"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_object;"]
#[doc = " #     use diesel::sql_types::{Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let jsonb = diesel::select(jsonb_object::<Array<Text>,_>(vec![\"hello\",\"world\"]))"]
#[doc = "                 .get_result::<Value>(connection)?;"]
#[doc = " let expected:Value = serde_json::json!({\"hello\":\"world\"});"]
#[doc = " assert_eq!(expected, jsonb);"]
#[doc = ""]
#[doc =
" let jsonb = diesel::select(jsonb_object::<Array<Text>, _>(vec![\"hello\",\"world\",\"John\",\"Doe\"]))"]
#[doc = "                 .get_result::<Value>(connection)?;"]
#[doc =
" let expected:Value = serde_json::json!({\"hello\": \"world\",\"John\": \"Doe\"});"]
#[doc = " assert_eq!(expected, jsonb);"]
#[doc = ""]
#[doc =
" let jsonb = diesel::select(jsonb_object::<Nullable<Array<Text>>, _>(None::<Vec<String>>))"]
#[doc = "                 .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(jsonb.is_none());"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let jsonb = diesel::select(jsonb_object::<Array<Nullable<Text>>,_>(empty))"]
#[doc = "                 .get_result::<Value>(connection)?;"]
#[doc = " let expected = serde_json::json!({});"]
#[doc = " assert_eq!(expected, jsonb);"]
#[doc = ""]
#[doc =
" let jsonb = diesel::select(jsonb_object::<Array<Text>, _>(vec![\"hello\",\"world\",\"John\"]))"]
#[doc = "                 .get_result::<Value>(connection);"]
#[doc = " assert!(jsonb.is_err());"]
#[doc = ""]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_object<Arr: TextArrayOrNullableTextArray +
    MaybeNullableValue<Jsonb>, text_array>(text_array: text_array)
    -> jsonb_object<Arr, text_array> where
    text_array: diesel::expression::AsExpression<Arr> {
    jsonb_object_utils::jsonb_object {
        text_array: text_array.as_expression(),
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_object()`](fn@jsonb_object)"]
pub type jsonb_object<Arr, text_array> =
    jsonb_object_utils::jsonb_object<Arr,
    <text_array as diesel::expression::AsExpression<Arr>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_object_return_type {
    #[doc =
    "Return type of the [`jsonb_object()`](fn@super::jsonb_object) SQL function."]
    pub type jsonb_object<text_array> =
        super::jsonb_object<<text_array as
        diesel::expression::Expression>::SqlType, text_array>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_object_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_object<Arr, text_array> {
        pub(in super) text_array: text_array,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<Arr, text_array, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_object<Arr, text_array> 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<Arr, text_array, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_object<Arr, text_array> 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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr: ::core::fmt::Debug, text_array: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_object<Arr, text_array> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_object", "text_array", &self.text_array, "Arr",
                &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::clone::Clone, text_array: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_object<Arr, text_array> {
        #[inline]
        fn clone(&self) -> jsonb_object<Arr, text_array> {
            jsonb_object {
                text_array: ::core::clone::Clone::clone(&self.text_array),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<Arr: ::core::marker::Copy, text_array: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_object<Arr, text_array> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr: diesel::query_builder::QueryId,
                text_array: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_object<Arr, text_array> {
                type QueryId =
                    jsonb_object<<Arr as
                    diesel::query_builder::QueryId>::QueryId,
                    <text_array as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <text_array as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_array as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_object()`](fn@jsonb_object)"]
    pub type HelperType<Arr, text_array> =
        jsonb_object<Arr, <text_array as AsExpression<Arr>>::Expression>;
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array> Expression for jsonb_object<Arr, text_array> where
        (text_array): Expression {
        type SqlType = Arr::Out;
    }
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array, __DieselInternal> SelectableExpression<__DieselInternal>
        for jsonb_object<Arr, text_array> where
        text_array: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array, __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_object<Arr, text_array> where
        text_array: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array, __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_object<Arr, text_array> where
        __DieselInternal: diesel::backend::Backend,
        text_array: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_object";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.text_array.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_array.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array> QueryFragment<crate::pg::Pg> for
        jsonb_object<Arr, text_array> where
        text_array: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<text_array>(text_array);
    const _: () =
        {
            use diesel;
            impl<text_array, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<text_array> where
                text_array: diesel::expression::ValidGrouping<__GroupByClause>
                {
                type IsAggregate =
                    <text_array as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>,
        text_array, __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_object<Arr, text_array> where
        __Derived<text_array>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<text_array> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" This form of jsonb_object takes keys and values pairwise from two separate arrays."]
#[doc = " In all other respects it is identical to the one-argument form."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_object_with_keys_and_values;"]
#[doc = " #     use diesel::sql_types::{Array, Nullable, Text};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc =
" let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>("]
#[doc = "             vec![\"hello\",\"John\"],vec![\"world\",\"Doe\"]))"]
#[doc = "             .get_result::<Value>(connection)?;"]
#[doc =
" let expected:Value = serde_json::json!({\"hello\":\"world\",\"John\":\"Doe\"});"]
#[doc = " assert_eq!(expected, jsonb);"]
#[doc = ""]
#[doc =
" let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Nullable<Array<Text>>, Nullable<Array<Text>>, _, _>("]
#[doc = "             Some(vec![\"hello\",\"John\"]),None::<Vec<String>>))"]
#[doc = "             .get_result::<Option<Value>>(connection)?;"]
#[doc = " assert_eq!(None::<Value>,jsonb);"]
#[doc = ""]
#[doc = " let empty: Vec<String> = Vec::new();"]
#[doc =
" let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>("]
#[doc = "             vec![\"hello\",\"John\"],empty))"]
#[doc = "             .get_result::<Value>(connection);"]
#[doc = " assert!(jsonb.is_err());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_object_with_keys_and_values<Arr1: TextArrayOrNullableTextArray +
    SingleValue, Arr2: TextArrayOrNullableTextArray +
    CombinedNullableValue<Arr1, Jsonb>, keys,
    values>(keys: keys, values: values)
    -> jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
    keys: diesel::expression::AsExpression<Arr1>,
    values: diesel::expression::AsExpression<Arr2> {
    jsonb_object_with_keys_and_values_utils::jsonb_object_with_keys_and_values {
        keys: keys.as_expression(),
        values: values.as_expression(),
        Arr1: ::core::marker::PhantomData,
        Arr2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_object_with_keys_and_values()`](fn@jsonb_object_with_keys_and_values)"]
pub type jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> =
    jsonb_object_with_keys_and_values_utils::jsonb_object_with_keys_and_values<Arr1,
    Arr2, <keys as diesel::expression::AsExpression<Arr1>>::Expression,
    <values as diesel::expression::AsExpression<Arr2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_object_with_keys_and_values_return_type {
    #[doc =
    "Return type of the [`jsonb_object_with_keys_and_values()`](fn@super::jsonb_object_with_keys_and_values) SQL function."]
    pub type jsonb_object_with_keys_and_values<keys, values> =
        super::jsonb_object_with_keys_and_values<<keys as
        diesel::expression::Expression>::SqlType,
        <values as diesel::expression::Expression>::SqlType, keys, values>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_object_with_keys_and_values_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        pub(in super) keys: keys,
        pub(in super) values: values,
        pub(in super) Arr1: ::core::marker::PhantomData<Arr1>,
        pub(in super) Arr2: ::core::marker::PhantomData<Arr2>,
    }
    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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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<Arr1, Arr2, keys, values, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<Arr1: ::core::fmt::Debug, Arr2: ::core::fmt::Debug,
        keys: ::core::fmt::Debug, values: ::core::fmt::Debug>
        ::core::fmt::Debug for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "jsonb_object_with_keys_and_values", "keys", &self.keys,
                "values", &self.values, "Arr1", &self.Arr1, "Arr2",
                &&self.Arr2)
        }
    }
    #[automatically_derived]
    impl<Arr1: ::core::clone::Clone, Arr2: ::core::clone::Clone,
        keys: ::core::clone::Clone, values: ::core::clone::Clone>
        ::core::clone::Clone for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
        #[inline]
        fn clone(&self)
            -> jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
            jsonb_object_with_keys_and_values {
                keys: ::core::clone::Clone::clone(&self.keys),
                values: ::core::clone::Clone::clone(&self.values),
                Arr1: ::core::clone::Clone::clone(&self.Arr1),
                Arr2: ::core::clone::Clone::clone(&self.Arr2),
            }
        }
    }
    #[automatically_derived]
    impl<Arr1: ::core::marker::Copy, Arr2: ::core::marker::Copy,
        keys: ::core::marker::Copy, values: ::core::marker::Copy>
        ::core::marker::Copy for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<Arr1: diesel::query_builder::QueryId,
                Arr2: diesel::query_builder::QueryId,
                keys: diesel::query_builder::QueryId,
                values: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> {
                type QueryId =
                    jsonb_object_with_keys_and_values<<Arr1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr2 as diesel::query_builder::QueryId>::QueryId,
                    <keys as diesel::query_builder::QueryId>::QueryId,
                    <values as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <Arr1 as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                    <Arr2 as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <keys as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <values as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <Arr1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <Arr2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <keys as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <values as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_object_with_keys_and_values()`](fn@jsonb_object_with_keys_and_values)"]
    pub type HelperType<Arr1, Arr2, keys, values> =
        jsonb_object_with_keys_and_values<Arr1, Arr2,
        <keys as AsExpression<Arr1>>::Expression,
        <values as AsExpression<Arr2>>::Expression>;
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values> Expression for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        (keys, values): Expression {
        type SqlType = Arr2::Out;
    }
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: SelectableExpression<__DieselInternal>,
        values: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: AppearsOnTable<__DieselInternal>,
        values: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        __DieselInternal: diesel::backend::Backend,
        keys: QueryFragment<__DieselInternal>,
        values: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_object";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.keys.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.keys.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.values.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.values.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values>
        QueryFragment<crate::pg::Pg> for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        keys: QueryFragment<crate::pg::Pg>,
        values: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<keys, values>(keys, values);
    const _: () =
        {
            use diesel;
            impl<keys, values, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<keys, values> where
                keys: diesel::expression::ValidGrouping<__GroupByClause>,
                values: diesel::expression::ValidGrouping<__GroupByClause>,
                <keys as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<values
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<keys as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<values as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<Arr1: TextArrayOrNullableTextArray + SingleValue,
        Arr2: TextArrayOrNullableTextArray +
        CombinedNullableValue<Arr1, Jsonb>, keys, values, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_object_with_keys_and_values<Arr1, Arr2, keys, values> where
        __Derived<keys, values>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<keys, values> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" This function `row_to_json` takes a Record type as an input and converts it to JSON."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::row_to_json;"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     use diesel::sql_types::{Record, Text, Integer};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let json_value = diesel::select(row_to_json(sql::<Record<(Text, Integer)>>("]
#[doc = "     \"ROW(\'John\', 30)\""]
#[doc = " )))"]
#[doc = " .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = serde_json::json!({"]
#[doc = "     \"f1\": \"John\","]
#[doc = "     \"f2\": 30"]
#[doc = " });"]
#[doc = " assert_eq!(expected, json_value);"]
#[doc = ""]
#[doc =
" let json_value = diesel::select(row_to_json(sql::<Record<()>>(\"ROW()\")))"]
#[doc = " .get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = serde_json::json!({});"]
#[doc = " assert_eq!(expected, json_value);"]
#[doc = ""]
#[doc = " #    Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn row_to_json<R: RecordOrNullableRecord + MaybeNullableValue<Json>,
    record>(record: record) -> row_to_json<R, record> where
    record: diesel::expression::AsExpression<R> {
    row_to_json_utils::row_to_json {
        record: record.as_expression(),
        R: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`row_to_json()`](fn@row_to_json)"]
pub type row_to_json<R, record> =
    row_to_json_utils::row_to_json<R,
    <record as diesel::expression::AsExpression<R>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __row_to_json_return_type {
    #[doc =
    "Return type of the [`row_to_json()`](fn@super::row_to_json) SQL function."]
    pub type row_to_json<record> =
        super::row_to_json<<record as
        diesel::expression::Expression>::SqlType, record>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod row_to_json_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct row_to_json<R, record> {
        pub(in super) record: record,
        pub(in super) R: ::core::marker::PhantomData<R>,
    }
    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<R, record, __Rhs> ::core::ops::Add<__Rhs> for
                row_to_json<R, record> 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<R, record, __Rhs> ::core::ops::Sub<__Rhs> for
                row_to_json<R, record> 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<R, record, __Rhs> ::core::ops::Mul<__Rhs> for
                row_to_json<R, record> 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<R, record, __Rhs> ::core::ops::Div<__Rhs> for
                row_to_json<R, record> 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())
                }
            }
        };
    #[automatically_derived]
    impl<R: ::core::fmt::Debug, record: ::core::fmt::Debug> ::core::fmt::Debug
        for row_to_json<R, record> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "row_to_json", "record", &self.record, "R", &&self.R)
        }
    }
    #[automatically_derived]
    impl<R: ::core::clone::Clone, record: ::core::clone::Clone>
        ::core::clone::Clone for row_to_json<R, record> {
        #[inline]
        fn clone(&self) -> row_to_json<R, record> {
            row_to_json {
                record: ::core::clone::Clone::clone(&self.record),
                R: ::core::clone::Clone::clone(&self.R),
            }
        }
    }
    #[automatically_derived]
    impl<R: ::core::marker::Copy, record: ::core::marker::Copy>
        ::core::marker::Copy for row_to_json<R, record> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<R: diesel::query_builder::QueryId,
                record: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for row_to_json<R, record> {
                type QueryId =
                    row_to_json<<R as diesel::query_builder::QueryId>::QueryId,
                    <record as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <R as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <record as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <R as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <record as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`row_to_json()`](fn@row_to_json)"]
    pub type HelperType<R, record> =
        row_to_json<R, <record as AsExpression<R>>::Expression>;
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record>
        Expression for row_to_json<R, record> where (record): Expression {
        type SqlType = R::Out;
    }
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        row_to_json<R, record> where
        record: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        row_to_json<R, record> where record: AppearsOnTable<__DieselInternal>,
        Self: Expression {}
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        row_to_json<R, record> where
        __DieselInternal: diesel::backend::Backend,
        record: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "row_to_json";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.record.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.record.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record>
        QueryFragment<crate::pg::Pg> for row_to_json<R, record> where
        record: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<record>(record);
    const _: () =
        {
            use diesel;
            impl<record, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<record> where
                record: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <record as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<R: RecordOrNullableRecord + MaybeNullableValue<Json>, record,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        row_to_json<R, record> where
        __Derived<record>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<record> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" This function `json_populate_record` takes a Record base and Json as an input and converts it to top-level"]
#[doc =
" JSON object to a row having the composite type of the base argument."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::json_populate_record;"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     use diesel::sql_types::{Record, Text, Integer, Json};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({"]
#[doc = "     \"f1\": \"Alice\","]
#[doc = "     \"f2\": 16"]
#[doc = " });"]
#[doc =
" let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"Alice\".to_string(), 16));"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({});"]
#[doc =
" let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"John\".to_string(), 30));"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({"]
#[doc = "     \"f1\": \"Alice\""]
#[doc = " });"]
#[doc =
" let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"Alice\".to_string(), 30));"]
#[doc = ""]
#[doc = " #    Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_populate_record<B: RecordOrNullableRecord + SingleValue,
    J: JsonOrNullableJson + CombinedAllNullableValue<Json, B>, base,
    from_json>(base: base, from_json: from_json)
    -> json_populate_record<B, J, base, from_json> where
    base: diesel::expression::AsExpression<B>,
    from_json: diesel::expression::AsExpression<J> {
    json_populate_record_utils::json_populate_record {
        base: base.as_expression(),
        from_json: from_json.as_expression(),
        B: ::core::marker::PhantomData,
        J: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_populate_record()`](fn@json_populate_record)"]
pub type json_populate_record<B, J, base, from_json> =
    json_populate_record_utils::json_populate_record<B, J,
    <base as diesel::expression::AsExpression<B>>::Expression,
    <from_json as diesel::expression::AsExpression<J>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_populate_record_return_type {
    #[doc =
    "Return type of the [`json_populate_record()`](fn@super::json_populate_record) SQL function."]
    pub type json_populate_record<base, from_json> =
        super::json_populate_record<<base as
        diesel::expression::Expression>::SqlType,
        <from_json as diesel::expression::Expression>::SqlType, base,
        from_json>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_populate_record_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_populate_record<B, J, base, from_json> {
        pub(in super) base: base,
        pub(in super) from_json: from_json,
        pub(in super) B: ::core::marker::PhantomData<B>,
        pub(in super) J: ::core::marker::PhantomData<J>,
    }
    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<B, J, base, from_json, __Rhs> ::core::ops::Add<__Rhs> for
                json_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Sub<__Rhs> for
                json_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Mul<__Rhs> for
                json_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Div<__Rhs> for
                json_populate_record<B, J, base, from_json> 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())
                }
            }
        };
    #[automatically_derived]
    impl<B: ::core::fmt::Debug, J: ::core::fmt::Debug,
        base: ::core::fmt::Debug, from_json: ::core::fmt::Debug>
        ::core::fmt::Debug for json_populate_record<B, J, base, from_json> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "json_populate_record", "base", &self.base, "from_json",
                &self.from_json, "B", &self.B, "J", &&self.J)
        }
    }
    #[automatically_derived]
    impl<B: ::core::clone::Clone, J: ::core::clone::Clone,
        base: ::core::clone::Clone, from_json: ::core::clone::Clone>
        ::core::clone::Clone for json_populate_record<B, J, base, from_json> {
        #[inline]
        fn clone(&self) -> json_populate_record<B, J, base, from_json> {
            json_populate_record {
                base: ::core::clone::Clone::clone(&self.base),
                from_json: ::core::clone::Clone::clone(&self.from_json),
                B: ::core::clone::Clone::clone(&self.B),
                J: ::core::clone::Clone::clone(&self.J),
            }
        }
    }
    #[automatically_derived]
    impl<B: ::core::marker::Copy, J: ::core::marker::Copy,
        base: ::core::marker::Copy, from_json: ::core::marker::Copy>
        ::core::marker::Copy for json_populate_record<B, J, base, from_json> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<B: diesel::query_builder::QueryId,
                J: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                from_json: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_populate_record<B, J, base, from_json> {
                type QueryId =
                    json_populate_record<<B as
                    diesel::query_builder::QueryId>::QueryId,
                    <J as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <from_json as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <B as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <base as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <from_json as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <B as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <from_json as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_populate_record()`](fn@json_populate_record)"]
    pub type HelperType<B, J, base, from_json> =
        json_populate_record<B, J, <base as AsExpression<B>>::Expression,
        <from_json as AsExpression<J>>::Expression>;
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json> Expression for
        json_populate_record<B, J, base, from_json> where
        (base, from_json): Expression {
        type SqlType = J::Out;
    }
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_populate_record<B, J, base, from_json> where
        base: SelectableExpression<__DieselInternal>,
        from_json: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        json_populate_record<B, J, base, from_json> where
        base: AppearsOnTable<__DieselInternal>,
        from_json: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        json_populate_record<B, J, base, from_json> where
        __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        from_json: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_populate_record";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.from_json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.from_json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json>
        QueryFragment<crate::pg::Pg> for
        json_populate_record<B, J, base, from_json> where
        base: QueryFragment<crate::pg::Pg>,
        from_json: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, from_json>(base, from_json);
    const _: () =
        {
            use diesel;
            impl<base, from_json, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, from_json> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                from_json: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<from_json
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<from_json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonOrNullableJson +
        CombinedAllNullableValue<Json, B>, base, from_json, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        json_populate_record<B, J, base, from_json> where
        __Derived<base, from_json>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, from_json> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" This function `jsonb_populate_record` takes a Record base and Jsonb as an input and converts it to top-level"]
#[doc =
" JSON object to a row having the composite type of the base argument."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_populate_record;"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     use diesel::sql_types::{Record, Text, Integer, Jsonb};"]
#[doc = " #     use serde_json::Value;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({"]
#[doc = "     \"f1\": \"Alice\","]
#[doc = "     \"f2\": 16"]
#[doc = " });"]
#[doc =
" let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"Alice\".to_string(), 16));"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({});"]
#[doc =
" let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"John\".to_string(), 30));"]
#[doc = ""]
#[doc = " let expected: Value = serde_json::json!({"]
#[doc = "     \"f2\": 42,"]
#[doc = " });"]
#[doc =
" let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>("]
#[doc = "         sql::<Record<(Text, Integer)>>(\"ROW(\'John\', 30)\"),"]
#[doc = "         expected"]
#[doc = " )).get_result(connection)?;"]
#[doc = " assert_eq!(record, (\"John\".to_string(), 42));"]
#[doc = ""]
#[doc = " #    Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_populate_record<B: RecordOrNullableRecord + SingleValue,
    J: JsonbOrNullableJsonb + CombinedAllNullableValue<Jsonb, B>, base,
    from_json>(base: base, from_json: from_json)
    -> jsonb_populate_record<B, J, base, from_json> where
    base: diesel::expression::AsExpression<B>,
    from_json: diesel::expression::AsExpression<J> {
    jsonb_populate_record_utils::jsonb_populate_record {
        base: base.as_expression(),
        from_json: from_json.as_expression(),
        B: ::core::marker::PhantomData,
        J: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_populate_record()`](fn@jsonb_populate_record)"]
pub type jsonb_populate_record<B, J, base, from_json> =
    jsonb_populate_record_utils::jsonb_populate_record<B, J,
    <base as diesel::expression::AsExpression<B>>::Expression,
    <from_json as diesel::expression::AsExpression<J>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_populate_record_return_type {
    #[doc =
    "Return type of the [`jsonb_populate_record()`](fn@super::jsonb_populate_record) SQL function."]
    pub type jsonb_populate_record<base, from_json> =
        super::jsonb_populate_record<<base as
        diesel::expression::Expression>::SqlType,
        <from_json as diesel::expression::Expression>::SqlType, base,
        from_json>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_populate_record_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_populate_record<B, J, base, from_json> {
        pub(in super) base: base,
        pub(in super) from_json: from_json,
        pub(in super) B: ::core::marker::PhantomData<B>,
        pub(in super) J: ::core::marker::PhantomData<J>,
    }
    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<B, J, base, from_json, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_populate_record<B, J, base, from_json> 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<B, J, base, from_json, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_populate_record<B, J, base, from_json> 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())
                }
            }
        };
    #[automatically_derived]
    impl<B: ::core::fmt::Debug, J: ::core::fmt::Debug,
        base: ::core::fmt::Debug, from_json: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_populate_record<B, J, base, from_json> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "jsonb_populate_record", "base", &self.base, "from_json",
                &self.from_json, "B", &self.B, "J", &&self.J)
        }
    }
    #[automatically_derived]
    impl<B: ::core::clone::Clone, J: ::core::clone::Clone,
        base: ::core::clone::Clone, from_json: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_populate_record<B, J, base, from_json>
        {
        #[inline]
        fn clone(&self) -> jsonb_populate_record<B, J, base, from_json> {
            jsonb_populate_record {
                base: ::core::clone::Clone::clone(&self.base),
                from_json: ::core::clone::Clone::clone(&self.from_json),
                B: ::core::clone::Clone::clone(&self.B),
                J: ::core::clone::Clone::clone(&self.J),
            }
        }
    }
    #[automatically_derived]
    impl<B: ::core::marker::Copy, J: ::core::marker::Copy,
        base: ::core::marker::Copy, from_json: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_populate_record<B, J, base, from_json>
        {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<B: diesel::query_builder::QueryId,
                J: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                from_json: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_populate_record<B, J, base, from_json> {
                type QueryId =
                    jsonb_populate_record<<B as
                    diesel::query_builder::QueryId>::QueryId,
                    <J as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <from_json as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <B as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <base as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <from_json as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <B as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <from_json as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_populate_record()`](fn@jsonb_populate_record)"]
    pub type HelperType<B, J, base, from_json> =
        jsonb_populate_record<B, J, <base as AsExpression<B>>::Expression,
        <from_json as AsExpression<J>>::Expression>;
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json> Expression for
        jsonb_populate_record<B, J, base, from_json> where
        (base, from_json): Expression {
        type SqlType = J::Out;
    }
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_populate_record<B, J, base, from_json> where
        base: SelectableExpression<__DieselInternal>,
        from_json: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_populate_record<B, J, base, from_json> where
        base: AppearsOnTable<__DieselInternal>,
        from_json: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_populate_record<B, J, base, from_json> where
        __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        from_json: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_populate_record";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.from_json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.from_json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json>
        QueryFragment<crate::pg::Pg> for
        jsonb_populate_record<B, J, base, from_json> where
        base: QueryFragment<crate::pg::Pg>,
        from_json: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, from_json>(base, from_json);
    const _: () =
        {
            use diesel;
            impl<base, from_json, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, from_json> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                from_json: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<from_json
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<from_json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<B: RecordOrNullableRecord + SingleValue, J: JsonbOrNullableJsonb +
        CombinedAllNullableValue<Jsonb, B>, base, from_json, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_populate_record<B, J, base, from_json> where
        __Derived<base, from_json>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, from_json> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns target with the item designated by path replaced by new_value,"]
#[doc =
"     or with new_value added and the item designated by path does not exist."]
#[doc = ""]
#[doc = " It can\'t set path in scalar"]
#[doc = ""]
#[doc =
" All earlier steps in the path must exist, or the target is returned unchanged."]
#[doc =
" As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays."]
#[doc = " If the last path step is an array index that is out of range,"]
#[doc =
"    the new value is added at the beginning of the array if the index is negative,"]
#[doc = "     or at the end of the array if it is positive."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_set;"]
#[doc = " #     use diesel::sql_types::{Jsonb,Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set::<Jsonb, Array<Text>, _, _, _>("]
#[doc = "         json!([{\"f1\":1,\"f2\":null},2,null,3]),"]
#[doc = "         vec![\"0\",\"f1\"],"]
#[doc = "         json!([2,3,4])"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc =
" let expected: Value = json!([{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set::<Jsonb, Array<Text>, _, _, _>("]
#[doc = "         json!([{\"odd\":[2,4,6,8]}]),"]
#[doc = "         // not vec![\"odd\"], cannot set path in scalar"]
#[doc = "         vec![\"0\",\"odd\"],"]
#[doc = "         json!([1,3,5,7])"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!([{\"odd\":[1,3,5,7]}]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let result = diesel::select(jsonb_set::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _>("]
#[doc = "         None::<Value>,"]
#[doc = "         empty,"]
#[doc = "         None::<Value>"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let result = diesel::select(jsonb_set::<Jsonb, Array<Nullable<Text>>, _, _, _>("]
#[doc = "         // cannot be json!(null)"]
#[doc = "         json!([]),"]
#[doc = "         empty,"]
#[doc = "         json!(null)"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected = json!([]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _,>("]
#[doc = "         json!(null),"]
#[doc = "         None::<Vec<String>>,"]
#[doc = "         json!({\"foo\": 42})"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_set<E: JsonbOrNullableJsonb + SingleValue,
    Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>, base,
    path, new_value>(base: base, path: path, new_value: new_value)
    -> jsonb_set<E, Arr, base, path, new_value> where
    base: diesel::expression::AsExpression<E>,
    path: diesel::expression::AsExpression<Arr>,
    new_value: diesel::expression::AsExpression<E> {
    jsonb_set_utils::jsonb_set {
        base: base.as_expression(),
        path: path.as_expression(),
        new_value: new_value.as_expression(),
        E: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_set()`](fn@jsonb_set)"]
pub type jsonb_set<E, Arr, base, path, new_value> =
    jsonb_set_utils::jsonb_set<E, Arr,
    <base as diesel::expression::AsExpression<E>>::Expression,
    <path as diesel::expression::AsExpression<Arr>>::Expression,
    <new_value as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_set_return_type {
    #[doc =
    "Return type of the [`jsonb_set()`](fn@super::jsonb_set) SQL function."]
    pub type jsonb_set<base, path, new_value> =
        super::jsonb_set<<base as diesel::expression::Expression>::SqlType,
        <path as diesel::expression::Expression>::SqlType, base, path,
        new_value>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_set_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_set<E, Arr, base, path, new_value> {
        pub(in super) base: base,
        pub(in super) path: path,
        pub(in super) new_value: new_value,
        pub(in super) E: ::core::marker::PhantomData<E>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Add<__Rhs>
                for jsonb_set<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Sub<__Rhs>
                for jsonb_set<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Mul<__Rhs>
                for jsonb_set<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Div<__Rhs>
                for jsonb_set<E, Arr, base, path, new_value> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        base: ::core::fmt::Debug, path: ::core::fmt::Debug,
        new_value: ::core::fmt::Debug> ::core::fmt::Debug for
        jsonb_set<E, Arr, base, path, new_value> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field5_finish(f, "jsonb_set",
                "base", &self.base, "path", &self.path, "new_value",
                &self.new_value, "E", &self.E, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, Arr: ::core::clone::Clone,
        base: ::core::clone::Clone, path: ::core::clone::Clone,
        new_value: ::core::clone::Clone> ::core::clone::Clone for
        jsonb_set<E, Arr, base, path, new_value> {
        #[inline]
        fn clone(&self) -> jsonb_set<E, Arr, base, path, new_value> {
            jsonb_set {
                base: ::core::clone::Clone::clone(&self.base),
                path: ::core::clone::Clone::clone(&self.path),
                new_value: ::core::clone::Clone::clone(&self.new_value),
                E: ::core::clone::Clone::clone(&self.E),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, Arr: ::core::marker::Copy,
        base: ::core::marker::Copy, path: ::core::marker::Copy,
        new_value: ::core::marker::Copy> ::core::marker::Copy for
        jsonb_set<E, Arr, base, path, new_value> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                path: diesel::query_builder::QueryId,
                new_value: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_set<E, Arr, base, path, new_value> {
                type QueryId =
                    jsonb_set<<E as diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <path as diesel::query_builder::QueryId>::QueryId,
                    <new_value as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <base as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <path as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <new_value as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                        <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <path as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <new_value as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_set()`](fn@jsonb_set)"]
    pub type HelperType<E, Arr, base, path, new_value> =
        jsonb_set<E, Arr, <base as AsExpression<E>>::Expression,
        <path as AsExpression<Arr>>::Expression,
        <new_value as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value> Expression for
        jsonb_set<E, Arr, base, path, new_value> where
        (base, path, new_value): Expression {
        type SqlType = Arr::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_set<E, Arr, base, path, new_value> where
        base: SelectableExpression<__DieselInternal>,
        path: SelectableExpression<__DieselInternal>,
        new_value: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_set<E, Arr, base, path, new_value> where
        base: AppearsOnTable<__DieselInternal>,
        path: AppearsOnTable<__DieselInternal>,
        new_value: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_set<E, Arr, base, path, new_value> where
        __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        path: QueryFragment<__DieselInternal>,
        new_value: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_set";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.path.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.path.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.new_value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.new_value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value> QueryFragment<crate::pg::Pg> for
        jsonb_set<E, Arr, base, path, new_value> where
        base: QueryFragment<crate::pg::Pg>,
        path: QueryFragment<crate::pg::Pg>,
        new_value: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, path, new_value>(base, path, new_value);
    const _: () =
        {
            use diesel;
            impl<base, path, new_value, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, path, new_value> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                path: diesel::expression::ValidGrouping<__GroupByClause>,
                new_value: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<path
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<new_value
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<path as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<new_value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_set<E, Arr, base, path, new_value> where
        __Derived<base, path, new_value>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, path, new_value> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns target with the item designated by path replaced by new_value,"]
#[doc =
"     or with new_value added if create_if_missing is true (which is the default)"]
#[doc = "     and the item designated by path does not exist."]
#[doc = ""]
#[doc = " It can\'t set path in scalar"]
#[doc = ""]
#[doc =
" All earlier steps in the path must exist, or the target is returned unchanged."]
#[doc =
" As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays."]
#[doc = " If the last path step is an array index that is out of range,"]
#[doc =
"     and create_if_missing is true, the new value is added at the beginning of the array if the index is negative,"]
#[doc = "     or at the end of the array if it is positive."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_set_create_if_missing;"]
#[doc = " #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json, Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>("]
#[doc = "         json!([{\"f1\":1,\"f2\":null},2,null,3]),"]
#[doc = "         vec![\"0\",\"f1\"],"]
#[doc = "         json!([2,3,4]),"]
#[doc = "         true"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc =
" let expected: Value = json!([{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>("]
#[doc = "         json!([{\"f1\":1,\"f2\":null},2,null,3]),"]
#[doc = "         vec![\"0\",\"f3\"],"]
#[doc = "         json!([2,3,4]),"]
#[doc = "         false"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc =
" let expected: Value = json!([{\"f1\":1, \"f2\": null},2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>("]
#[doc = "         json!([{\"odd\":[2,4,6,8]}]),"]
#[doc = "         // not vec![\"odd\"], cannot set path in scalar"]
#[doc = "         vec![\"0\",\"odd\"],"]
#[doc = "         json!([1,3,5,7]),"]
#[doc = "         true"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!([{\"odd\":[1,3,5,7]}]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _, _>("]
#[doc = "         None::<Value>,"]
#[doc = "         empty,"]
#[doc = "         None::<Value>,"]
#[doc = "         true"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Nullable<Text>>, _, _, _, _>("]
#[doc = "         // cannot be json!(null)"]
#[doc = "         json!([]),"]
#[doc = "         empty,"]
#[doc = "         json!(null),"]
#[doc = "         true"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected = json!([]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _, _>("]
#[doc = "         json!(null),"]
#[doc = "         None::<Vec<String>>,"]
#[doc = "         json!({\"foo\": 42}),"]
#[doc = "         true"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_set_create_if_missing<E: JsonbOrNullableJsonb + SingleValue,
    Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>, base,
    path, new_value,
    create_if_missing>(base: base, path: path, new_value: new_value,
    create_if_missing: create_if_missing)
    ->
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where base: diesel::expression::AsExpression<E>,
    path: diesel::expression::AsExpression<Arr>,
    new_value: diesel::expression::AsExpression<E>,
    create_if_missing: diesel::expression::AsExpression<Bool> {
    jsonb_set_create_if_missing_utils::jsonb_set_create_if_missing {
        base: base.as_expression(),
        path: path.as_expression(),
        new_value: new_value.as_expression(),
        create_if_missing: create_if_missing.as_expression(),
        E: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_set_create_if_missing()`](fn@jsonb_set_create_if_missing)"]
pub type
    jsonb_set_create_if_missing<E, Arr, base, path, new_value,
    create_if_missing> =
    jsonb_set_create_if_missing_utils::jsonb_set_create_if_missing<E, Arr,
    <base as diesel::expression::AsExpression<E>>::Expression,
    <path as diesel::expression::AsExpression<Arr>>::Expression,
    <new_value as diesel::expression::AsExpression<E>>::Expression,
    <create_if_missing as
    diesel::expression::AsExpression<Bool>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_set_create_if_missing_return_type {
    #[doc =
    "Return type of the [`jsonb_set_create_if_missing()`](fn@super::jsonb_set_create_if_missing) SQL function."]
    pub type
        jsonb_set_create_if_missing<base, path, new_value, create_if_missing>
        =
        super::jsonb_set_create_if_missing<<base as
        diesel::expression::Expression>::SqlType,
        <path as diesel::expression::Expression>::SqlType, base, path,
        new_value, create_if_missing>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_set_create_if_missing_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> {
        pub(in super) base: base,
        pub(in super) path: path,
        pub(in super) new_value: new_value,
        pub(in super) create_if_missing: create_if_missing,
        pub(in super) E: ::core::marker::PhantomData<E>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<E, Arr, base, path, new_value, create_if_missing, __Rhs>
                ::core::ops::Add<__Rhs> for
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> 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<E, Arr, base, path, new_value, create_if_missing, __Rhs>
                ::core::ops::Sub<__Rhs> for
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> 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<E, Arr, base, path, new_value, create_if_missing, __Rhs>
                ::core::ops::Mul<__Rhs> for
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> 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<E, Arr, base, path, new_value, create_if_missing, __Rhs>
                ::core::ops::Div<__Rhs> for
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        base: ::core::fmt::Debug, path: ::core::fmt::Debug,
        new_value: ::core::fmt::Debug, create_if_missing: ::core::fmt::Debug>
        ::core::fmt::Debug for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["base", "path", "new_value", "create_if_missing", "E",
                            "Arr"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.base, &self.path, &self.new_value,
                            &self.create_if_missing, &self.E, &&self.Arr];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "jsonb_set_create_if_missing", names, values)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, Arr: ::core::clone::Clone,
        base: ::core::clone::Clone, path: ::core::clone::Clone,
        new_value: ::core::clone::Clone,
        create_if_missing: ::core::clone::Clone> ::core::clone::Clone for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> {
        #[inline]
        fn clone(&self)
            ->
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> {
            jsonb_set_create_if_missing {
                base: ::core::clone::Clone::clone(&self.base),
                path: ::core::clone::Clone::clone(&self.path),
                new_value: ::core::clone::Clone::clone(&self.new_value),
                create_if_missing: ::core::clone::Clone::clone(&self.create_if_missing),
                E: ::core::clone::Clone::clone(&self.E),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, Arr: ::core::marker::Copy,
        base: ::core::marker::Copy, path: ::core::marker::Copy,
        new_value: ::core::marker::Copy,
        create_if_missing: ::core::marker::Copy> ::core::marker::Copy for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                path: diesel::query_builder::QueryId,
                new_value: diesel::query_builder::QueryId,
                create_if_missing: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_set_create_if_missing<E, Arr, base, path, new_value,
                create_if_missing> {
                type QueryId =
                    jsonb_set_create_if_missing<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <path as diesel::query_builder::QueryId>::QueryId,
                    <new_value as diesel::query_builder::QueryId>::QueryId,
                    <create_if_missing as
                    diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <base as
                                            diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                    <path as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <new_value as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <create_if_missing as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <path as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <new_value as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <create_if_missing as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_set_create_if_missing()`](fn@jsonb_set_create_if_missing)"]
    pub type HelperType<E, Arr, base, path, new_value, create_if_missing> =
        jsonb_set_create_if_missing<E, Arr,
        <base as AsExpression<E>>::Expression,
        <path as AsExpression<Arr>>::Expression,
        <new_value as AsExpression<E>>::Expression,
        <create_if_missing as AsExpression<Bool>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing> Expression for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where
        (base, path, new_value, create_if_missing): Expression {
        type SqlType = Arr::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where base: SelectableExpression<__DieselInternal>,
        path: SelectableExpression<__DieselInternal>,
        new_value: SelectableExpression<__DieselInternal>,
        create_if_missing: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where base: AppearsOnTable<__DieselInternal>,
        path: AppearsOnTable<__DieselInternal>,
        new_value: AppearsOnTable<__DieselInternal>,
        create_if_missing: AppearsOnTable<__DieselInternal>, Self: Expression
        {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        path: QueryFragment<__DieselInternal>,
        new_value: QueryFragment<__DieselInternal>,
        create_if_missing: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_set";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.path.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.path.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.new_value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.new_value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.create_if_missing.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.create_if_missing.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing> QueryFragment<crate::pg::Pg>
        for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where base: QueryFragment<crate::pg::Pg>,
        path: QueryFragment<crate::pg::Pg>,
        new_value: QueryFragment<crate::pg::Pg>,
        create_if_missing: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, path, new_value,
        create_if_missing>(base, path, new_value, create_if_missing);
    const _: () =
        {
            use diesel;
            impl<base, path, new_value, create_if_missing, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, path, new_value, create_if_missing> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                path: diesel::expression::ValidGrouping<__GroupByClause>,
                new_value: diesel::expression::ValidGrouping<__GroupByClause>,
                create_if_missing: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<path
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<new_value
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                as
                diesel::expression::MixedAggregates<<new_value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<create_if_missing
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<path as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<new_value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<create_if_missing as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_set_create_if_missing<E, Arr, base, path, new_value,
        create_if_missing> where
        __Derived<base, path, new_value,
        create_if_missing>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, path, new_value, create_if_missing> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Returns target with the item designated by path replaced by new_value,"]
#[doc =
"     or with new_value added and the item designated by path does not exist."]
#[doc = ""]
#[doc = " It can\'t set path in scalar"]
#[doc = ""]
#[doc =
" All earlier steps in the path must exist, or the target is returned unchanged."]
#[doc =
" As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays."]
#[doc = " If the last path step is an array index that is out of range,"]
#[doc =
"    the new value is added at the beginning of the array if the index is negative,"]
#[doc = "     or at the end of the array if it is positive."]
#[doc = ""]
#[doc = " If new_value is not NULL, behaves identically to jsonb_set."]
#[doc =
"    Otherwise behaves according to the value of null_value_treatment"]
#[doc =
"    which must be one of \'raise_exception\', \'use_json_null\', \'delete_key\', or \'return_target\'."]
#[doc = "    The default is \'use_json_null\'."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_set_lax;"]
#[doc =
" #     use diesel::sql_types::{Jsonb,Array,NullValueTreatment, Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let null_value_treatment = NullValueTreatment::UseJsonNull;"]
#[doc =
" let result = diesel::select(jsonb_set_lax::<Jsonb, Array<Text>, _, _, _, _, _>("]
#[doc = "         json!([{\"f1\":1,\"f2\":null},2,null,3]),"]
#[doc = "         vec![\"0\",\"f1\"],"]
#[doc = "         json!([2,3,4]),"]
#[doc = "         true,"]
#[doc = "         null_value_treatment"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc =
" let expected: Value = json!([{\"f1\": [2, 3, 4], \"f2\": null}, 2, null, 3]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = " let null_value_treatment = NullValueTreatment::ReturnTarget;"]
#[doc =
" let result = diesel::select(jsonb_set_lax::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _, _, _>("]
#[doc = "         json!([{\"f1\":99,\"f2\":null},2]),"]
#[doc = "         vec![\"0\",\"f3\"],"]
#[doc = "         None::<Value>,"]
#[doc = "         true,"]
#[doc = "         null_value_treatment"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert_eq!(result, Some(json!([{\"f1\":99,\"f2\":null},2])));"]
#[doc = ""]
#[doc = " let null_value_treatment = NullValueTreatment::UseJsonNull;"]
#[doc = " let empty:Vec<String> = Vec::new();"]
#[doc =
" let result = diesel::select(jsonb_set_lax::<Jsonb, Array<Nullable<Text>>, _, _, _, _, _>("]
#[doc = "         // cannot be json!(null)"]
#[doc = "         json!([]),"]
#[doc = "         empty,"]
#[doc = "         json!(null),"]
#[doc = "         true,"]
#[doc = "         null_value_treatment"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected = json!([]);"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = " let null_value_treatment = NullValueTreatment::UseJsonNull;"]
#[doc =
" let result = diesel::select(jsonb_set_lax::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _, _, _,>("]
#[doc = "         json!(null),"]
#[doc = "         None::<Vec<String>>,"]
#[doc = "         json!({\"foo\": 42}),"]
#[doc = "         true,"]
#[doc = "         null_value_treatment"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert!(result.is_none());"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_set_lax<E: JsonbOrNullableJsonb + SingleValue,
    Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>, base,
    path, new_value, create_if_missing,
    null_value_treatment>(base: base, path: path, new_value: new_value,
    create_if_missing: create_if_missing,
    null_value_treatment: null_value_treatment)
    ->
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where base: diesel::expression::AsExpression<E>,
    path: diesel::expression::AsExpression<Arr>,
    new_value: diesel::expression::AsExpression<E>,
    create_if_missing: diesel::expression::AsExpression<Bool>,
    null_value_treatment: diesel::expression::AsExpression<NullValueTreatmentEnum> {
    jsonb_set_lax_utils::jsonb_set_lax {
        base: base.as_expression(),
        path: path.as_expression(),
        new_value: new_value.as_expression(),
        create_if_missing: create_if_missing.as_expression(),
        null_value_treatment: null_value_treatment.as_expression(),
        E: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_set_lax()`](fn@jsonb_set_lax)"]
pub type
    jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
    null_value_treatment> =
    jsonb_set_lax_utils::jsonb_set_lax<E, Arr,
    <base as diesel::expression::AsExpression<E>>::Expression,
    <path as diesel::expression::AsExpression<Arr>>::Expression,
    <new_value as diesel::expression::AsExpression<E>>::Expression,
    <create_if_missing as diesel::expression::AsExpression<Bool>>::Expression,
    <null_value_treatment as
    diesel::expression::AsExpression<NullValueTreatmentEnum>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_set_lax_return_type {
    #[doc =
    "Return type of the [`jsonb_set_lax()`](fn@super::jsonb_set_lax) SQL function."]
    pub type
        jsonb_set_lax<base, path, new_value, create_if_missing,
        null_value_treatment> =
        super::jsonb_set_lax<<base as
        diesel::expression::Expression>::SqlType,
        <path as diesel::expression::Expression>::SqlType, base, path,
        new_value, create_if_missing, null_value_treatment>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_set_lax_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> {
        pub(in super) base: base,
        pub(in super) path: path,
        pub(in super) new_value: new_value,
        pub(in super) create_if_missing: create_if_missing,
        pub(in super) null_value_treatment: null_value_treatment,
        pub(in super) E: ::core::marker::PhantomData<E>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<E, Arr, base, path, new_value, create_if_missing,
                null_value_treatment, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> 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<E, Arr, base, path, new_value, create_if_missing,
                null_value_treatment, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> 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<E, Arr, base, path, new_value, create_if_missing,
                null_value_treatment, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> 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<E, Arr, base, path, new_value, create_if_missing,
                null_value_treatment, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        base: ::core::fmt::Debug, path: ::core::fmt::Debug,
        new_value: ::core::fmt::Debug, create_if_missing: ::core::fmt::Debug,
        null_value_treatment: ::core::fmt::Debug> ::core::fmt::Debug for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["base", "path", "new_value", "create_if_missing",
                            "null_value_treatment", "E", "Arr"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.base, &self.path, &self.new_value,
                            &self.create_if_missing, &self.null_value_treatment,
                            &self.E, &&self.Arr];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "jsonb_set_lax", names, values)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, Arr: ::core::clone::Clone,
        base: ::core::clone::Clone, path: ::core::clone::Clone,
        new_value: ::core::clone::Clone,
        create_if_missing: ::core::clone::Clone,
        null_value_treatment: ::core::clone::Clone> ::core::clone::Clone for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> {
        #[inline]
        fn clone(&self)
            ->
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> {
            jsonb_set_lax {
                base: ::core::clone::Clone::clone(&self.base),
                path: ::core::clone::Clone::clone(&self.path),
                new_value: ::core::clone::Clone::clone(&self.new_value),
                create_if_missing: ::core::clone::Clone::clone(&self.create_if_missing),
                null_value_treatment: ::core::clone::Clone::clone(&self.null_value_treatment),
                E: ::core::clone::Clone::clone(&self.E),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, Arr: ::core::marker::Copy,
        base: ::core::marker::Copy, path: ::core::marker::Copy,
        new_value: ::core::marker::Copy,
        create_if_missing: ::core::marker::Copy,
        null_value_treatment: ::core::marker::Copy> ::core::marker::Copy for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                path: diesel::query_builder::QueryId,
                new_value: diesel::query_builder::QueryId,
                create_if_missing: diesel::query_builder::QueryId,
                null_value_treatment: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_set_lax<E, Arr, base, path, new_value,
                create_if_missing, null_value_treatment> {
                type QueryId =
                    jsonb_set_lax<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <path as diesel::query_builder::QueryId>::QueryId,
                    <new_value as diesel::query_builder::QueryId>::QueryId,
                    <create_if_missing as
                    diesel::query_builder::QueryId>::QueryId,
                    <null_value_treatment as
                    diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                                &&
                                                <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <base as
                                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                        <path as
                                            diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                    <new_value as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <create_if_missing as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <null_value_treatment as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                                <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                            ||
                                            <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <path as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <new_value as
                                        diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                <create_if_missing as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <null_value_treatment as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_set_lax()`](fn@jsonb_set_lax)"]
    pub type
        HelperType<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> =
        jsonb_set_lax<E, Arr, <base as AsExpression<E>>::Expression,
        <path as AsExpression<Arr>>::Expression,
        <new_value as AsExpression<E>>::Expression,
        <create_if_missing as AsExpression<Bool>>::Expression,
        <null_value_treatment as
        AsExpression<NullValueTreatmentEnum>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment>
        Expression for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where
        (base, path, new_value, create_if_missing,
        null_value_treatment): Expression {
        type SqlType = Arr::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where
        base: SelectableExpression<__DieselInternal>,
        path: SelectableExpression<__DieselInternal>,
        new_value: SelectableExpression<__DieselInternal>,
        create_if_missing: SelectableExpression<__DieselInternal>,
        null_value_treatment: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where base: AppearsOnTable<__DieselInternal>,
        path: AppearsOnTable<__DieselInternal>,
        new_value: AppearsOnTable<__DieselInternal>,
        create_if_missing: AppearsOnTable<__DieselInternal>,
        null_value_treatment: AppearsOnTable<__DieselInternal>,
        Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where
        __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        path: QueryFragment<__DieselInternal>,
        new_value: QueryFragment<__DieselInternal>,
        create_if_missing: QueryFragment<__DieselInternal>,
        null_value_treatment: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_set_lax";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.path.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.path.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.new_value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.new_value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.create_if_missing.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.create_if_missing.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.null_value_treatment.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.null_value_treatment.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment>
        QueryFragment<crate::pg::Pg> for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where base: QueryFragment<crate::pg::Pg>,
        path: QueryFragment<crate::pg::Pg>,
        new_value: QueryFragment<crate::pg::Pg>,
        create_if_missing: QueryFragment<crate::pg::Pg>,
        null_value_treatment: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, path, new_value, create_if_missing,
        null_value_treatment>(base, path, new_value, create_if_missing,
        null_value_treatment);
    const _: () =
        {
            use diesel;
            impl<base, path, new_value, create_if_missing,
                null_value_treatment, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, path, new_value, create_if_missing,
                null_value_treatment> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                path: diesel::expression::ValidGrouping<__GroupByClause>,
                new_value: diesel::expression::ValidGrouping<__GroupByClause>,
                create_if_missing: diesel::expression::ValidGrouping<__GroupByClause>,
                null_value_treatment: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<path
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<new_value
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                as
                diesel::expression::MixedAggregates<<new_value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<create_if_missing
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<<<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                as
                diesel::expression::MixedAggregates<<new_value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                as
                diesel::expression::MixedAggregates<<create_if_missing as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<null_value_treatment
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<<<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<path as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<new_value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<create_if_missing as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<null_value_treatment as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, create_if_missing, null_value_treatment,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_set_lax<E, Arr, base, path, new_value, create_if_missing,
        null_value_treatment> where
        __Derived<base, path, new_value, create_if_missing,
        null_value_treatment>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, path, new_value, create_if_missing,
            null_value_treatment> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns target with `new_value` inserted into `base`."]
#[doc = ""]
#[doc =
" If the item designated by the `path` is an array element, `new_value` will be inserted before that item"]
#[doc = ""]
#[doc =
" If the item designated by the `path` is an object field, `new_value` will be"]
#[doc = " inserted only if the object does not already contain that key."]
#[doc = ""]
#[doc =
" * All earlier steps in the path must exist, or the target is returned unchanged."]
#[doc =
" * As with the path oriented operators, negative integers that appear in the `path` count"]
#[doc = "   from the end of JSON arrays."]
#[doc = " * If the last `path` step is an array index that is out of range,"]
#[doc =
"   the new value is added at the beginning of the array if the index is negative,"]
#[doc = "   or at the end of the array if it is positive."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_insert;"]
#[doc = " #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_insert::<Jsonb, Array<Text>, _, _, _>("]
#[doc = "         json!({\"a\":[0,1,2]}),"]
#[doc = "         vec![\"a\",\"1\"],"]
#[doc = "         json!(\"new_value\"),"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!({\"a\":[0,\"new_value\",1,2]});"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_insert::<Nullable<Jsonb>, Array<Text>, _, _, _>("]
#[doc = "         None::<serde_json::Value>,"]
#[doc = "         vec![\"a\",\"1\"],"]
#[doc = "         Some(json!(\"new_value\")),"]
#[doc = "     )).get_result::<Option<Value>>(connection)?;"]
#[doc = " assert_eq!(result, None);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_insert<E: JsonbOrNullableJsonb + SingleValue,
    Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>, base,
    path, new_value>(base: base, path: path, new_value: new_value)
    -> jsonb_insert<E, Arr, base, path, new_value> where
    base: diesel::expression::AsExpression<E>,
    path: diesel::expression::AsExpression<Arr>,
    new_value: diesel::expression::AsExpression<E> {
    jsonb_insert_utils::jsonb_insert {
        base: base.as_expression(),
        path: path.as_expression(),
        new_value: new_value.as_expression(),
        E: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`jsonb_insert()`](fn@jsonb_insert)"]
pub type jsonb_insert<E, Arr, base, path, new_value> =
    jsonb_insert_utils::jsonb_insert<E, Arr,
    <base as diesel::expression::AsExpression<E>>::Expression,
    <path as diesel::expression::AsExpression<Arr>>::Expression,
    <new_value as diesel::expression::AsExpression<E>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_insert_return_type {
    #[doc =
    "Return type of the [`jsonb_insert()`](fn@super::jsonb_insert) SQL function."]
    pub type jsonb_insert<base, path, new_value> =
        super::jsonb_insert<<base as diesel::expression::Expression>::SqlType,
        <path as diesel::expression::Expression>::SqlType, base, path,
        new_value>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_insert_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_insert<E, Arr, base, path, new_value> {
        pub(in super) base: base,
        pub(in super) path: path,
        pub(in super) new_value: new_value,
        pub(in super) E: ::core::marker::PhantomData<E>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Add<__Rhs>
                for jsonb_insert<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Sub<__Rhs>
                for jsonb_insert<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Mul<__Rhs>
                for jsonb_insert<E, Arr, base, path, new_value> 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<E, Arr, base, path, new_value, __Rhs> ::core::ops::Div<__Rhs>
                for jsonb_insert<E, Arr, base, path, new_value> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        base: ::core::fmt::Debug, path: ::core::fmt::Debug,
        new_value: ::core::fmt::Debug> ::core::fmt::Debug for
        jsonb_insert<E, Arr, base, path, new_value> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field5_finish(f,
                "jsonb_insert", "base", &self.base, "path", &self.path,
                "new_value", &self.new_value, "E", &self.E, "Arr", &&self.Arr)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, Arr: ::core::clone::Clone,
        base: ::core::clone::Clone, path: ::core::clone::Clone,
        new_value: ::core::clone::Clone> ::core::clone::Clone for
        jsonb_insert<E, Arr, base, path, new_value> {
        #[inline]
        fn clone(&self) -> jsonb_insert<E, Arr, base, path, new_value> {
            jsonb_insert {
                base: ::core::clone::Clone::clone(&self.base),
                path: ::core::clone::Clone::clone(&self.path),
                new_value: ::core::clone::Clone::clone(&self.new_value),
                E: ::core::clone::Clone::clone(&self.E),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, Arr: ::core::marker::Copy,
        base: ::core::marker::Copy, path: ::core::marker::Copy,
        new_value: ::core::marker::Copy> ::core::marker::Copy for
        jsonb_insert<E, Arr, base, path, new_value> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                path: diesel::query_builder::QueryId,
                new_value: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_insert<E, Arr, base, path, new_value> {
                type QueryId =
                    jsonb_insert<<E as diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <path as diesel::query_builder::QueryId>::QueryId,
                    <new_value as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <base as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <path as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <new_value as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                        <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <path as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <new_value as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc = "The return type of [`jsonb_insert()`](fn@jsonb_insert)"]
    pub type HelperType<E, Arr, base, path, new_value> =
        jsonb_insert<E, Arr, <base as AsExpression<E>>::Expression,
        <path as AsExpression<Arr>>::Expression,
        <new_value as AsExpression<E>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value> Expression for
        jsonb_insert<E, Arr, base, path, new_value> where
        (base, path, new_value): Expression {
        type SqlType = Arr::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_insert<E, Arr, base, path, new_value> where
        base: SelectableExpression<__DieselInternal>,
        path: SelectableExpression<__DieselInternal>,
        new_value: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_insert<E, Arr, base, path, new_value> where
        base: AppearsOnTable<__DieselInternal>,
        path: AppearsOnTable<__DieselInternal>,
        new_value: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_insert<E, Arr, base, path, new_value> where
        __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        path: QueryFragment<__DieselInternal>,
        new_value: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_insert";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.path.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.path.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.new_value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.new_value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value> QueryFragment<crate::pg::Pg> for
        jsonb_insert<E, Arr, base, path, new_value> where
        base: QueryFragment<crate::pg::Pg>,
        path: QueryFragment<crate::pg::Pg>,
        new_value: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, path, new_value>(base, path, new_value);
    const _: () =
        {
            use diesel;
            impl<base, path, new_value, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, path, new_value> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                path: diesel::expression::ValidGrouping<__GroupByClause>,
                new_value: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<path
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<new_value
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<path as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<new_value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_insert<E, Arr, base, path, new_value> where
        __Derived<base, path, new_value>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, path, new_value> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc = " Returns target with `new_value` inserted into `base`."]
#[doc = ""]
#[doc =
" If the item designated by the `path` is an array element, `new_value` will be inserted before that"]
#[doc = " item if `insert_after` is false (which is the default),"]
#[doc = " or after it if `insert_after` is true."]
#[doc = ""]
#[doc =
" If the item designated by the `path` is an object field, `new_value` will be inserted only"]
#[doc = " if the object does not already contain that key."]
#[doc = ""]
#[doc =
" * All earlier steps in the `path` must exist, or the target is returned unchanged."]
#[doc =
" * As with the path oriented operators, negative integers that appear in the `path` count"]
#[doc = "   from the end of JSON arrays."]
#[doc = " * If the last `path` step is an array index that is out of range,"]
#[doc =
"   the new value is added at the beginning of the array if the index is negative,"]
#[doc = "   or at the end of the array if it is positive."]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::jsonb_insert_with_insert_after;"]
#[doc = " #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_insert_with_insert_after::<Jsonb, Array<Text>, _, _, _, _>("]
#[doc = "         json!({\"a\":[0,1,2]}),"]
#[doc = "         vec![\"a\",\"1\"],"]
#[doc = "         json!(\"new_value\"),"]
#[doc = "         false"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!({\"a\":[0,\"new_value\",1,2]});"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_insert_with_insert_after::<Jsonb, Array<Text>, _, _, _, _>("]
#[doc = "         json!({\"a\":[0,1,2]}),"]
#[doc = "         vec![\"a\",\"1\"],"]
#[doc = "         json!(\"new_value\"),"]
#[doc = "         true"]
#[doc = "     )).get_result::<Value>(connection)?;"]
#[doc = " let expected: Value = json!({\"a\":[0,1,\"new_value\",2,]});"]
#[doc = " assert_eq!(result, expected);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_insert_with_insert_after<E: JsonbOrNullableJsonb + SingleValue,
    Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>, base,
    path, new_value,
    insert_after>(base: base, path: path, new_value: new_value,
    insert_after: insert_after)
    ->
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where base: diesel::expression::AsExpression<E>,
    path: diesel::expression::AsExpression<Arr>,
    new_value: diesel::expression::AsExpression<E>,
    insert_after: diesel::expression::AsExpression<Bool> {
    jsonb_insert_with_insert_after_utils::jsonb_insert_with_insert_after {
        base: base.as_expression(),
        path: path.as_expression(),
        new_value: new_value.as_expression(),
        insert_after: insert_after.as_expression(),
        E: ::core::marker::PhantomData,
        Arr: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_insert_with_insert_after()`](fn@jsonb_insert_with_insert_after)"]
pub type
    jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
    insert_after> =
    jsonb_insert_with_insert_after_utils::jsonb_insert_with_insert_after<E,
    Arr, <base as diesel::expression::AsExpression<E>>::Expression,
    <path as diesel::expression::AsExpression<Arr>>::Expression,
    <new_value as diesel::expression::AsExpression<E>>::Expression,
    <insert_after as diesel::expression::AsExpression<Bool>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_insert_with_insert_after_return_type {
    #[doc =
    "Return type of the [`jsonb_insert_with_insert_after()`](fn@super::jsonb_insert_with_insert_after) SQL function."]
    pub type
        jsonb_insert_with_insert_after<base, path, new_value, insert_after> =
        super::jsonb_insert_with_insert_after<<base as
        diesel::expression::Expression>::SqlType,
        <path as diesel::expression::Expression>::SqlType, base, path,
        new_value, insert_after>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_insert_with_insert_after_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> {
        pub(in super) base: base,
        pub(in super) path: path,
        pub(in super) new_value: new_value,
        pub(in super) insert_after: insert_after,
        pub(in super) E: ::core::marker::PhantomData<E>,
        pub(in super) Arr: ::core::marker::PhantomData<Arr>,
    }
    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<E, Arr, base, path, new_value, insert_after, __Rhs>
                ::core::ops::Add<__Rhs> for
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> 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<E, Arr, base, path, new_value, insert_after, __Rhs>
                ::core::ops::Sub<__Rhs> for
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> 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<E, Arr, base, path, new_value, insert_after, __Rhs>
                ::core::ops::Mul<__Rhs> for
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> 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<E, Arr, base, path, new_value, insert_after, __Rhs>
                ::core::ops::Div<__Rhs> for
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> 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())
                }
            }
        };
    #[automatically_derived]
    impl<E: ::core::fmt::Debug, Arr: ::core::fmt::Debug,
        base: ::core::fmt::Debug, path: ::core::fmt::Debug,
        new_value: ::core::fmt::Debug, insert_after: ::core::fmt::Debug>
        ::core::fmt::Debug for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["base", "path", "new_value", "insert_after", "E", "Arr"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.base, &self.path, &self.new_value, &self.insert_after,
                            &self.E, &&self.Arr];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "jsonb_insert_with_insert_after", names, values)
        }
    }
    #[automatically_derived]
    impl<E: ::core::clone::Clone, Arr: ::core::clone::Clone,
        base: ::core::clone::Clone, path: ::core::clone::Clone,
        new_value: ::core::clone::Clone, insert_after: ::core::clone::Clone>
        ::core::clone::Clone for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> {
        #[inline]
        fn clone(&self)
            ->
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> {
            jsonb_insert_with_insert_after {
                base: ::core::clone::Clone::clone(&self.base),
                path: ::core::clone::Clone::clone(&self.path),
                new_value: ::core::clone::Clone::clone(&self.new_value),
                insert_after: ::core::clone::Clone::clone(&self.insert_after),
                E: ::core::clone::Clone::clone(&self.E),
                Arr: ::core::clone::Clone::clone(&self.Arr),
            }
        }
    }
    #[automatically_derived]
    impl<E: ::core::marker::Copy, Arr: ::core::marker::Copy,
        base: ::core::marker::Copy, path: ::core::marker::Copy,
        new_value: ::core::marker::Copy, insert_after: ::core::marker::Copy>
        ::core::marker::Copy for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<E: diesel::query_builder::QueryId,
                Arr: diesel::query_builder::QueryId,
                base: diesel::query_builder::QueryId,
                path: diesel::query_builder::QueryId,
                new_value: diesel::query_builder::QueryId,
                insert_after: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
                insert_after> {
                type QueryId =
                    jsonb_insert_with_insert_after<<E as
                    diesel::query_builder::QueryId>::QueryId,
                    <Arr as diesel::query_builder::QueryId>::QueryId,
                    <base as diesel::query_builder::QueryId>::QueryId,
                    <path as diesel::query_builder::QueryId>::QueryId,
                    <new_value as diesel::query_builder::QueryId>::QueryId,
                    <insert_after as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <E as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <Arr as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <base as
                                            diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                    <path as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <new_value as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <insert_after as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <E as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <Arr as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <base as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <path as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <new_value as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <insert_after as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_insert_with_insert_after()`](fn@jsonb_insert_with_insert_after)"]
    pub type HelperType<E, Arr, base, path, new_value, insert_after> =
        jsonb_insert_with_insert_after<E, Arr,
        <base as AsExpression<E>>::Expression,
        <path as AsExpression<Arr>>::Expression,
        <new_value as AsExpression<E>>::Expression,
        <insert_after as AsExpression<Bool>>::Expression>;
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after> Expression for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where (base, path, new_value, insert_after): Expression
        {
        type SqlType = Arr::Out;
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where base: SelectableExpression<__DieselInternal>,
        path: SelectableExpression<__DieselInternal>,
        new_value: SelectableExpression<__DieselInternal>,
        insert_after: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where base: AppearsOnTable<__DieselInternal>,
        path: AppearsOnTable<__DieselInternal>,
        new_value: AppearsOnTable<__DieselInternal>,
        insert_after: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where __DieselInternal: diesel::backend::Backend,
        base: QueryFragment<__DieselInternal>,
        path: QueryFragment<__DieselInternal>,
        new_value: QueryFragment<__DieselInternal>,
        insert_after: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_insert";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.base.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.base.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.path.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.path.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.new_value.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.new_value.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.insert_after.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.insert_after.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after> QueryFragment<crate::pg::Pg> for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where base: QueryFragment<crate::pg::Pg>,
        path: QueryFragment<crate::pg::Pg>,
        new_value: QueryFragment<crate::pg::Pg>,
        insert_after: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<base, path, new_value,
        insert_after>(base, path, new_value, insert_after);
    const _: () =
        {
            use diesel;
            impl<base, path, new_value, insert_after, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<base, path, new_value, insert_after> where
                base: diesel::expression::ValidGrouping<__GroupByClause>,
                path: diesel::expression::ValidGrouping<__GroupByClause>,
                new_value: diesel::expression::ValidGrouping<__GroupByClause>,
                insert_after: diesel::expression::ValidGrouping<__GroupByClause>,
                <base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<path
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<new_value
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<<base as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<path as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                as
                diesel::expression::MixedAggregates<<new_value as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<insert_after
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<<base as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<path as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<new_value as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<insert_after as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<E: JsonbOrNullableJsonb + SingleValue,
        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
        base, path, new_value, insert_after, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_insert_with_insert_after<E, Arr, base, path, new_value,
        insert_after> where
        __Derived<base, path, new_value,
        insert_after>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<base, path, new_value, insert_after> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_json."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_build_array_0`, `json_build_array_1`, ... `json_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{json_build_array_1, json_build_array_2, json_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_build_array_0() -> json_build_array_0 where  {
    json_build_array_0_utils::json_build_array_0 {}
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_build_array_0()`](fn@json_build_array_0)"]
pub type json_build_array_0 = json_build_array_0_utils::json_build_array_0<>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_build_array_0_return_type {
    #[doc =
    "Return type of the [`json_build_array_0()`](fn@super::json_build_array_0) SQL function."]
    pub type json_build_array_0 = super::json_build_array_0<>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_build_array_0_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_build_array_0 {}
    #[automatically_derived]
    impl ::core::fmt::Debug for json_build_array_0 {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::write_str(f, "json_build_array_0")
        }
    }
    #[automatically_derived]
    #[doc(hidden)]
    unsafe impl ::core::clone::TrivialClone for json_build_array_0 { }
    #[automatically_derived]
    impl ::core::clone::Clone for json_build_array_0 {
        #[inline]
        fn clone(&self) -> json_build_array_0 { *self }
    }
    #[automatically_derived]
    impl ::core::marker::Copy for json_build_array_0 { }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl diesel::query_builder::QueryId for json_build_array_0 {
                type QueryId = json_build_array_0<>;
                const HAS_STATIC_QUERY_ID: bool = true;
                const IS_WINDOW_FUNCTION: bool = false;
            }
        };
    #[doc =
    "The return type of [`json_build_array_0()`](fn@json_build_array_0)"]
    pub type HelperType = json_build_array_0<>;
    impl Expression for json_build_array_0 where  {
        type SqlType = Json;
    }
    impl<__DieselInternal> SelectableExpression<__DieselInternal> for
        json_build_array_0 where Self: AppearsOnTable<__DieselInternal> {}
    impl<__DieselInternal> AppearsOnTable<__DieselInternal> for
        json_build_array_0 where Self: Expression {}
    impl<__DieselInternal> FunctionFragment<__DieselInternal> for
        json_build_array_0 where __DieselInternal: diesel::backend::Backend {
        const FUNCTION_NAME: &'static str = "json_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            Ok(())
        }
    }
    impl QueryFragment<crate::pg::Pg> for json_build_array_0 where  {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived();
    const _: () =
        {
            use diesel;
            impl<__GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived {
                type IsAggregate = diesel::expression::is_aggregate::Never;
            }
        };
    impl<__DieselInternal> ValidGrouping<__DieselInternal> for
        json_build_array_0 where __Derived<>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_json."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_build_array_0`, `json_build_array_1`, ... `json_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{json_build_array_1, json_build_array_2, json_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_build_array_1<V1: SingleValue, value_1>(value_1: value_1)
    -> json_build_array_1<V1, value_1> where
    value_1: diesel::expression::AsExpression<V1> {
    json_build_array_1_utils::json_build_array_1 {
        value_1: value_1.as_expression(),
        V1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_build_array_1()`](fn@json_build_array_1)"]
pub type json_build_array_1<V1, value_1> =
    json_build_array_1_utils::json_build_array_1<V1,
    <value_1 as diesel::expression::AsExpression<V1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_build_array_1_return_type {
    #[doc =
    "Return type of the [`json_build_array_1()`](fn@super::json_build_array_1) SQL function."]
    pub type json_build_array_1<value_1> =
        super::json_build_array_1<<value_1 as
        diesel::expression::Expression>::SqlType, value_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_build_array_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_build_array_1<V1, value_1> {
        pub(in super) value_1: value_1,
        pub(in super) V1: ::core::marker::PhantomData<V1>,
    }
    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<V1, value_1, __Rhs> ::core::ops::Add<__Rhs> for
                json_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Sub<__Rhs> for
                json_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Mul<__Rhs> for
                json_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Div<__Rhs> for
                json_build_array_1<V1, value_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<V1: ::core::fmt::Debug, value_1: ::core::fmt::Debug>
        ::core::fmt::Debug for json_build_array_1<V1, value_1> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "json_build_array_1", "value_1", &self.value_1, "V1",
                &&self.V1)
        }
    }
    #[automatically_derived]
    impl<V1: ::core::clone::Clone, value_1: ::core::clone::Clone>
        ::core::clone::Clone for json_build_array_1<V1, value_1> {
        #[inline]
        fn clone(&self) -> json_build_array_1<V1, value_1> {
            json_build_array_1 {
                value_1: ::core::clone::Clone::clone(&self.value_1),
                V1: ::core::clone::Clone::clone(&self.V1),
            }
        }
    }
    #[automatically_derived]
    impl<V1: ::core::marker::Copy, value_1: ::core::marker::Copy>
        ::core::marker::Copy for json_build_array_1<V1, value_1> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<V1: diesel::query_builder::QueryId,
                value_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_build_array_1<V1, value_1> {
                type QueryId =
                    json_build_array_1<<V1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <value_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <V1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <value_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <V1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <value_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_build_array_1()`](fn@json_build_array_1)"]
    pub type HelperType<V1, value_1> =
        json_build_array_1<V1, <value_1 as AsExpression<V1>>::Expression>;
    impl<V1: SingleValue, value_1> Expression for
        json_build_array_1<V1, value_1> where (value_1): Expression {
        type SqlType = Json;
    }
    impl<V1: SingleValue, value_1, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_build_array_1<V1, value_1> where
        value_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<V1: SingleValue, value_1, __DieselInternal>
        AppearsOnTable<__DieselInternal> for json_build_array_1<V1, value_1>
        where value_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<V1: SingleValue, value_1, __DieselInternal>
        FunctionFragment<__DieselInternal> for json_build_array_1<V1, value_1>
        where __DieselInternal: diesel::backend::Backend,
        value_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<V1: SingleValue, value_1> QueryFragment<crate::pg::Pg> for
        json_build_array_1<V1, value_1> where
        value_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value_1>(value_1);
    const _: () =
        {
            use diesel;
            impl<value_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value_1> where
                value_1: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <value_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<V1: SingleValue, value_1, __DieselInternal>
        ValidGrouping<__DieselInternal> for json_build_array_1<V1, value_1>
        where __Derived<value_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_json."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_build_array_0`, `json_build_array_1`, ... `json_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{json_build_array_1, json_build_array_2, json_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_build_array_2<V1: SingleValue, V2: SingleValue, value_1,
    value_2>(value_1: value_1, value_2: value_2)
    -> json_build_array_2<V1, V2, value_1, value_2> where
    value_1: diesel::expression::AsExpression<V1>,
    value_2: diesel::expression::AsExpression<V2> {
    json_build_array_2_utils::json_build_array_2 {
        value_1: value_1.as_expression(),
        value_2: value_2.as_expression(),
        V1: ::core::marker::PhantomData,
        V2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc = "The return type of [`json_build_array_2()`](fn@json_build_array_2)"]
pub type json_build_array_2<V1, V2, value_1, value_2> =
    json_build_array_2_utils::json_build_array_2<V1, V2,
    <value_1 as diesel::expression::AsExpression<V1>>::Expression,
    <value_2 as diesel::expression::AsExpression<V2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_build_array_2_return_type {
    #[doc =
    "Return type of the [`json_build_array_2()`](fn@super::json_build_array_2) SQL function."]
    pub type json_build_array_2<value_1, value_2> =
        super::json_build_array_2<<value_1 as
        diesel::expression::Expression>::SqlType,
        <value_2 as diesel::expression::Expression>::SqlType, value_1,
        value_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_build_array_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_build_array_2<V1, V2, value_1, value_2> {
        pub(in super) value_1: value_1,
        pub(in super) value_2: value_2,
        pub(in super) V1: ::core::marker::PhantomData<V1>,
        pub(in super) V2: ::core::marker::PhantomData<V2>,
    }
    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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Add<__Rhs> for
                json_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Sub<__Rhs> for
                json_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Mul<__Rhs> for
                json_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Div<__Rhs> for
                json_build_array_2<V1, V2, value_1, value_2> 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())
                }
            }
        };
    #[automatically_derived]
    impl<V1: ::core::fmt::Debug, V2: ::core::fmt::Debug,
        value_1: ::core::fmt::Debug, value_2: ::core::fmt::Debug>
        ::core::fmt::Debug for json_build_array_2<V1, V2, value_1, value_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "json_build_array_2", "value_1", &self.value_1, "value_2",
                &self.value_2, "V1", &self.V1, "V2", &&self.V2)
        }
    }
    #[automatically_derived]
    impl<V1: ::core::clone::Clone, V2: ::core::clone::Clone,
        value_1: ::core::clone::Clone, value_2: ::core::clone::Clone>
        ::core::clone::Clone for json_build_array_2<V1, V2, value_1, value_2>
        {
        #[inline]
        fn clone(&self) -> json_build_array_2<V1, V2, value_1, value_2> {
            json_build_array_2 {
                value_1: ::core::clone::Clone::clone(&self.value_1),
                value_2: ::core::clone::Clone::clone(&self.value_2),
                V1: ::core::clone::Clone::clone(&self.V1),
                V2: ::core::clone::Clone::clone(&self.V2),
            }
        }
    }
    #[automatically_derived]
    impl<V1: ::core::marker::Copy, V2: ::core::marker::Copy,
        value_1: ::core::marker::Copy, value_2: ::core::marker::Copy>
        ::core::marker::Copy for json_build_array_2<V1, V2, value_1, value_2>
        {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<V1: diesel::query_builder::QueryId,
                V2: diesel::query_builder::QueryId,
                value_1: diesel::query_builder::QueryId,
                value_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_build_array_2<V1, V2, value_1, value_2> {
                type QueryId =
                    json_build_array_2<<V1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <V2 as diesel::query_builder::QueryId>::QueryId,
                    <value_1 as diesel::query_builder::QueryId>::QueryId,
                    <value_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <V1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <V2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <value_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <value_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <V1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <V2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <value_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <value_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_build_array_2()`](fn@json_build_array_2)"]
    pub type HelperType<V1, V2, value_1, value_2> =
        json_build_array_2<V1, V2, <value_1 as AsExpression<V1>>::Expression,
        <value_2 as AsExpression<V2>>::Expression>;
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2> Expression for
        json_build_array_2<V1, V2, value_1, value_2> where
        (value_1, value_2): Expression {
        type SqlType = Json;
    }
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_build_array_2<V1, V2, value_1, value_2> where
        value_1: SelectableExpression<__DieselInternal>,
        value_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        json_build_array_2<V1, V2, value_1, value_2> where
        value_1: AppearsOnTable<__DieselInternal>,
        value_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        json_build_array_2<V1, V2, value_1, value_2> where
        __DieselInternal: diesel::backend::Backend,
        value_1: QueryFragment<__DieselInternal>,
        value_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.value_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2>
        QueryFragment<crate::pg::Pg> for
        json_build_array_2<V1, V2, value_1, value_2> where
        value_1: QueryFragment<crate::pg::Pg>,
        value_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value_1, value_2>(value_1, value_2);
    const _: () =
        {
            use diesel;
            impl<value_1, value_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value_1, value_2> where
                value_1: diesel::expression::ValidGrouping<__GroupByClause>,
                value_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <value_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<value_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<value_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<value_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        json_build_array_2<V1, V2, value_1, value_2> where
        __Derived<value_1, value_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value_1, value_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __json_build_array_return_types {
    #[doc(inline)]
    pub use super::__json_build_array_0_return_type::*;
    #[doc(inline)]
    pub use super::__json_build_array_1_return_type::*;
    #[doc(inline)]
    pub use super::__json_build_array_2_return_type::*;
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_jsonb."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_build_array_0`, `jsonb_build_array_1`, ... `jsonb_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_build_array_1, jsonb_build_array_2, jsonb_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_build_array_0() -> jsonb_build_array_0 where  {
    jsonb_build_array_0_utils::jsonb_build_array_0 {}
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_build_array_0()`](fn@jsonb_build_array_0)"]
pub type jsonb_build_array_0 =
    jsonb_build_array_0_utils::jsonb_build_array_0<>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_build_array_0_return_type {
    #[doc =
    "Return type of the [`jsonb_build_array_0()`](fn@super::jsonb_build_array_0) SQL function."]
    pub type jsonb_build_array_0 = super::jsonb_build_array_0<>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_build_array_0_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_build_array_0 {}
    #[automatically_derived]
    impl ::core::fmt::Debug for jsonb_build_array_0 {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::write_str(f, "jsonb_build_array_0")
        }
    }
    #[automatically_derived]
    #[doc(hidden)]
    unsafe impl ::core::clone::TrivialClone for jsonb_build_array_0 { }
    #[automatically_derived]
    impl ::core::clone::Clone for jsonb_build_array_0 {
        #[inline]
        fn clone(&self) -> jsonb_build_array_0 { *self }
    }
    #[automatically_derived]
    impl ::core::marker::Copy for jsonb_build_array_0 { }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl diesel::query_builder::QueryId for jsonb_build_array_0 {
                type QueryId = jsonb_build_array_0<>;
                const HAS_STATIC_QUERY_ID: bool = true;
                const IS_WINDOW_FUNCTION: bool = false;
            }
        };
    #[doc =
    "The return type of [`jsonb_build_array_0()`](fn@jsonb_build_array_0)"]
    pub type HelperType = jsonb_build_array_0<>;
    impl Expression for jsonb_build_array_0 where  {
        type SqlType = Jsonb;
    }
    impl<__DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_build_array_0 where Self: AppearsOnTable<__DieselInternal> {}
    impl<__DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_build_array_0 where Self: Expression {}
    impl<__DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_build_array_0 where __DieselInternal: diesel::backend::Backend {
        const FUNCTION_NAME: &'static str = "jsonb_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            Ok(())
        }
    }
    impl QueryFragment<crate::pg::Pg> for jsonb_build_array_0 where  {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived();
    const _: () =
        {
            use diesel;
            impl<__GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived {
                type IsAggregate = diesel::expression::is_aggregate::Never;
            }
        };
    impl<__DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_build_array_0 where __Derived<>: ValidGrouping<__DieselInternal>
        {
        type IsAggregate =
            <__Derived<> as ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_jsonb."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_build_array_0`, `jsonb_build_array_1`, ... `jsonb_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_build_array_1, jsonb_build_array_2, jsonb_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_build_array_1<V1: SingleValue, value_1>(value_1: value_1)
    -> jsonb_build_array_1<V1, value_1> where
    value_1: diesel::expression::AsExpression<V1> {
    jsonb_build_array_1_utils::jsonb_build_array_1 {
        value_1: value_1.as_expression(),
        V1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_build_array_1()`](fn@jsonb_build_array_1)"]
pub type jsonb_build_array_1<V1, value_1> =
    jsonb_build_array_1_utils::jsonb_build_array_1<V1,
    <value_1 as diesel::expression::AsExpression<V1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_build_array_1_return_type {
    #[doc =
    "Return type of the [`jsonb_build_array_1()`](fn@super::jsonb_build_array_1) SQL function."]
    pub type jsonb_build_array_1<value_1> =
        super::jsonb_build_array_1<<value_1 as
        diesel::expression::Expression>::SqlType, value_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_build_array_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_build_array_1<V1, value_1> {
        pub(in super) value_1: value_1,
        pub(in super) V1: ::core::marker::PhantomData<V1>,
    }
    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<V1, value_1, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_build_array_1<V1, value_1> 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<V1, value_1, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_build_array_1<V1, value_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<V1: ::core::fmt::Debug, value_1: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_build_array_1<V1, value_1> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field2_finish(f,
                "jsonb_build_array_1", "value_1", &self.value_1, "V1",
                &&self.V1)
        }
    }
    #[automatically_derived]
    impl<V1: ::core::clone::Clone, value_1: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_build_array_1<V1, value_1> {
        #[inline]
        fn clone(&self) -> jsonb_build_array_1<V1, value_1> {
            jsonb_build_array_1 {
                value_1: ::core::clone::Clone::clone(&self.value_1),
                V1: ::core::clone::Clone::clone(&self.V1),
            }
        }
    }
    #[automatically_derived]
    impl<V1: ::core::marker::Copy, value_1: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_build_array_1<V1, value_1> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<V1: diesel::query_builder::QueryId,
                value_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_build_array_1<V1, value_1> {
                type QueryId =
                    jsonb_build_array_1<<V1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <value_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <V1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                            &&
                            <value_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <V1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <value_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_build_array_1()`](fn@jsonb_build_array_1)"]
    pub type HelperType<V1, value_1> =
        jsonb_build_array_1<V1, <value_1 as AsExpression<V1>>::Expression>;
    impl<V1: SingleValue, value_1> Expression for
        jsonb_build_array_1<V1, value_1> where (value_1): Expression {
        type SqlType = Jsonb;
    }
    impl<V1: SingleValue, value_1, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_build_array_1<V1, value_1> where
        value_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<V1: SingleValue, value_1, __DieselInternal>
        AppearsOnTable<__DieselInternal> for jsonb_build_array_1<V1, value_1>
        where value_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<V1: SingleValue, value_1, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_build_array_1<V1, value_1> where
        __DieselInternal: diesel::backend::Backend,
        value_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<V1: SingleValue, value_1> QueryFragment<crate::pg::Pg> for
        jsonb_build_array_1<V1, value_1> where
        value_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value_1>(value_1);
    const _: () =
        {
            use diesel;
            impl<value_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value_1> where
                value_1: diesel::expression::ValidGrouping<__GroupByClause> {
                type IsAggregate =
                    <value_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate;
            }
        };
    impl<V1: SingleValue, value_1, __DieselInternal>
        ValidGrouping<__DieselInternal> for jsonb_build_array_1<V1, value_1>
        where __Derived<value_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_jsonb."]
#[doc = ""]
#[doc = ""]
#[doc = " # Example"]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_build_array_0`, `jsonb_build_array_1`, ... `jsonb_build_array_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_build_array")]
#[doc = ""]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_build_array_1, jsonb_build_array_2, jsonb_build_array_0};"]
#[doc =
" #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_0()).get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Text, _>(\"abc\"))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\"]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Text, Double, _, _>(\"abc\", 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([\"abc\", 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>(\"ROW(\'abc\',3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":\"abc\","]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([ [1, 2, 3] ]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = " assert_eq!(json!([None::<String>, 3.1415]), result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>(\"ROW(null,3.1415)\")))"]
#[doc = "     .get_result::<serde_json::Value>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(json!(["]
#[doc = "     {"]
#[doc = "         \"f1\":None::<String>,"]
#[doc = "         \"f2\":3.1415"]
#[doc = "     }"]
#[doc = "  ]), result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_build_array_2<V1: SingleValue, V2: SingleValue, value_1,
    value_2>(value_1: value_1, value_2: value_2)
    -> jsonb_build_array_2<V1, V2, value_1, value_2> where
    value_1: diesel::expression::AsExpression<V1>,
    value_2: diesel::expression::AsExpression<V2> {
    jsonb_build_array_2_utils::jsonb_build_array_2 {
        value_1: value_1.as_expression(),
        value_2: value_2.as_expression(),
        V1: ::core::marker::PhantomData,
        V2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_build_array_2()`](fn@jsonb_build_array_2)"]
pub type jsonb_build_array_2<V1, V2, value_1, value_2> =
    jsonb_build_array_2_utils::jsonb_build_array_2<V1, V2,
    <value_1 as diesel::expression::AsExpression<V1>>::Expression,
    <value_2 as diesel::expression::AsExpression<V2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_build_array_2_return_type {
    #[doc =
    "Return type of the [`jsonb_build_array_2()`](fn@super::jsonb_build_array_2) SQL function."]
    pub type jsonb_build_array_2<value_1, value_2> =
        super::jsonb_build_array_2<<value_1 as
        diesel::expression::Expression>::SqlType,
        <value_2 as diesel::expression::Expression>::SqlType, value_1,
        value_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_build_array_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_build_array_2<V1, V2, value_1, value_2> {
        pub(in super) value_1: value_1,
        pub(in super) value_2: value_2,
        pub(in super) V1: ::core::marker::PhantomData<V1>,
        pub(in super) V2: ::core::marker::PhantomData<V2>,
    }
    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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_build_array_2<V1, V2, value_1, value_2> 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<V1, V2, value_1, value_2, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_build_array_2<V1, V2, value_1, value_2> 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())
                }
            }
        };
    #[automatically_derived]
    impl<V1: ::core::fmt::Debug, V2: ::core::fmt::Debug,
        value_1: ::core::fmt::Debug, value_2: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_build_array_2<V1, V2, value_1, value_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "jsonb_build_array_2", "value_1", &self.value_1, "value_2",
                &self.value_2, "V1", &self.V1, "V2", &&self.V2)
        }
    }
    #[automatically_derived]
    impl<V1: ::core::clone::Clone, V2: ::core::clone::Clone,
        value_1: ::core::clone::Clone, value_2: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_build_array_2<V1, V2, value_1, value_2>
        {
        #[inline]
        fn clone(&self) -> jsonb_build_array_2<V1, V2, value_1, value_2> {
            jsonb_build_array_2 {
                value_1: ::core::clone::Clone::clone(&self.value_1),
                value_2: ::core::clone::Clone::clone(&self.value_2),
                V1: ::core::clone::Clone::clone(&self.V1),
                V2: ::core::clone::Clone::clone(&self.V2),
            }
        }
    }
    #[automatically_derived]
    impl<V1: ::core::marker::Copy, V2: ::core::marker::Copy,
        value_1: ::core::marker::Copy, value_2: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_build_array_2<V1, V2, value_1, value_2>
        {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<V1: diesel::query_builder::QueryId,
                V2: diesel::query_builder::QueryId,
                value_1: diesel::query_builder::QueryId,
                value_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_build_array_2<V1, V2, value_1, value_2> {
                type QueryId =
                    jsonb_build_array_2<<V1 as
                    diesel::query_builder::QueryId>::QueryId,
                    <V2 as diesel::query_builder::QueryId>::QueryId,
                    <value_1 as diesel::query_builder::QueryId>::QueryId,
                    <value_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <V1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <V2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <value_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <value_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <V1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <V2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <value_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <value_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_build_array_2()`](fn@jsonb_build_array_2)"]
    pub type HelperType<V1, V2, value_1, value_2> =
        jsonb_build_array_2<V1, V2, <value_1 as AsExpression<V1>>::Expression,
        <value_2 as AsExpression<V2>>::Expression>;
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2> Expression for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        (value_1, value_2): Expression {
        type SqlType = Jsonb;
    }
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        value_1: SelectableExpression<__DieselInternal>,
        value_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        value_1: AppearsOnTable<__DieselInternal>,
        value_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        __DieselInternal: diesel::backend::Backend,
        value_1: QueryFragment<__DieselInternal>,
        value_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_build_array";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.value_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.value_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.value_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2>
        QueryFragment<crate::pg::Pg> for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        value_1: QueryFragment<crate::pg::Pg>,
        value_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<value_1, value_2>(value_1, value_2);
    const _: () =
        {
            use diesel;
            impl<value_1, value_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<value_1, value_2> where
                value_1: diesel::expression::ValidGrouping<__GroupByClause>,
                value_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <value_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<value_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<value_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<value_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<V1: SingleValue, V2: SingleValue, value_1, value_2, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_build_array_2<V1, V2, value_1, value_2> where
        __Derived<value_1, value_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<value_1, value_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __jsonb_build_array_return_types {
    #[doc(inline)]
    pub use super::__jsonb_build_array_0_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_build_array_1_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_build_array_2_return_type::*;
}
#[doc =
" Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_extract_path_0`, `json_extract_path_1`, ... `json_extract_path_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_extract_path")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::{json_extract_path_1, json_extract_path_2};"]
#[doc = " #     use diesel::sql_types::{Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected = Some(json!({\"f5\":99, \"f6\":\"foo\"}));"]
#[doc =
" let result = diesel::select(json_extract_path_1::<Json, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(json!(\"foo\"));"]
#[doc =
" let result = diesel::select(json_extract_path_2::<Json, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_2::<Json, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_extract_path_1<J: JsonOrNullableJson + SingleValue,
    T1: SingleValue, json, text_1>(json: json, text_1: text_1)
    -> json_extract_path_1<J, T1, json, text_1> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1> {
    json_extract_path_1_utils::json_extract_path_1 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_extract_path_1()`](fn@json_extract_path_1)"]
pub type json_extract_path_1<J, T1, json, text_1> =
    json_extract_path_1_utils::json_extract_path_1<J, T1,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_extract_path_1_return_type {
    #[doc =
    "Return type of the [`json_extract_path_1()`](fn@super::json_extract_path_1) SQL function."]
    pub type json_extract_path_1<json, text_1> =
        super::json_extract_path_1<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType, json, text_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_extract_path_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_extract_path_1<J, T1, json, text_1> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
    }
    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<J, T1, json, text_1, __Rhs> ::core::ops::Add<__Rhs> for
                json_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Sub<__Rhs> for
                json_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Mul<__Rhs> for
                json_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Div<__Rhs> for
                json_extract_path_1<J, T1, json, text_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        json: ::core::fmt::Debug, text_1: ::core::fmt::Debug>
        ::core::fmt::Debug for json_extract_path_1<J, T1, json, text_1> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "json_extract_path_1", "json", &self.json, "text_1",
                &self.text_1, "J", &self.J, "T1", &&self.T1)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        json: ::core::clone::Clone, text_1: ::core::clone::Clone>
        ::core::clone::Clone for json_extract_path_1<J, T1, json, text_1> {
        #[inline]
        fn clone(&self) -> json_extract_path_1<J, T1, json, text_1> {
            json_extract_path_1 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        json: ::core::marker::Copy, text_1: ::core::marker::Copy>
        ::core::marker::Copy for json_extract_path_1<J, T1, json, text_1> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_extract_path_1<J, T1, json, text_1> {
                type QueryId =
                    json_extract_path_1<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <json as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_extract_path_1()`](fn@json_extract_path_1)"]
    pub type HelperType<J, T1, json, text_1> =
        json_extract_path_1<J, T1, <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression>;
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1>
        Expression for json_extract_path_1<J, T1, json, text_1> where
        (json, text_1): Expression {
        type SqlType = Nullable<Json>;
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        json_extract_path_1<J, T1, json, text_1> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        json_extract_path_1<J, T1, json, text_1> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        json_extract_path_1<J, T1, json, text_1> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_extract_path";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1>
        QueryFragment<crate::pg::Pg> for
        json_extract_path_1<J, T1, json, text_1> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1>(json, text_1);
    const _: () =
        {
            use diesel;
            impl<json, text_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        json_extract_path_1<J, T1, json, text_1> where
        __Derived<json, text_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_extract_path_0`, `json_extract_path_1`, ... `json_extract_path_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_extract_path")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc = " #     use diesel::dsl::{json_extract_path_1, json_extract_path_2};"]
#[doc = " #     use diesel::sql_types::{Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected = Some(json!({\"f5\":99, \"f6\":\"foo\"}));"]
#[doc =
" let result = diesel::select(json_extract_path_1::<Json, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(json!(\"foo\"));"]
#[doc =
" let result = diesel::select(json_extract_path_2::<Json, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_2::<Json, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_extract_path_2<J: JsonOrNullableJson + SingleValue,
    T1: SingleValue, T2: SingleValue, json, text_1,
    text_2>(json: json, text_1: text_1, text_2: text_2)
    -> json_extract_path_2<J, T1, T2, json, text_1, text_2> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1>,
    text_2: diesel::expression::AsExpression<T2> {
    json_extract_path_2_utils::json_extract_path_2 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        text_2: text_2.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
        T2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_extract_path_2()`](fn@json_extract_path_2)"]
pub type json_extract_path_2<J, T1, T2, json, text_1, text_2> =
    json_extract_path_2_utils::json_extract_path_2<J, T1, T2,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression,
    <text_2 as diesel::expression::AsExpression<T2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_extract_path_2_return_type {
    #[doc =
    "Return type of the [`json_extract_path_2()`](fn@super::json_extract_path_2) SQL function."]
    pub type json_extract_path_2<json, text_1, text_2> =
        super::json_extract_path_2<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType,
        <text_2 as diesel::expression::Expression>::SqlType, json, text_1,
        text_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_extract_path_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_extract_path_2<J, T1, T2, json, text_1, text_2> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) text_2: text_2,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
        pub(in super) T2: ::core::marker::PhantomData<T2>,
    }
    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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Add<__Rhs> for
                json_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Sub<__Rhs> for
                json_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Mul<__Rhs> for
                json_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Div<__Rhs> for
                json_extract_path_2<J, T1, T2, json, text_1, text_2> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        T2: ::core::fmt::Debug, json: ::core::fmt::Debug,
        text_1: ::core::fmt::Debug, text_2: ::core::fmt::Debug>
        ::core::fmt::Debug for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["json", "text_1", "text_2", "J", "T1", "T2"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.json, &self.text_1, &self.text_2, &self.J, &self.T1,
                            &&self.T2];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "json_extract_path_2", names, values)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        T2: ::core::clone::Clone, json: ::core::clone::Clone,
        text_1: ::core::clone::Clone, text_2: ::core::clone::Clone>
        ::core::clone::Clone for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn clone(&self)
            -> json_extract_path_2<J, T1, T2, json, text_1, text_2> {
            json_extract_path_2 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                text_2: ::core::clone::Clone::clone(&self.text_2),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
                T2: ::core::clone::Clone::clone(&self.T2),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        T2: ::core::marker::Copy, json: ::core::marker::Copy,
        text_1: ::core::marker::Copy, text_2: ::core::marker::Copy>
        ::core::marker::Copy for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                T2: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId,
                text_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_extract_path_2<J, T1, T2, json, text_1, text_2> {
                type QueryId =
                    json_extract_path_2<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <T2 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId,
                    <text_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <T2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <json as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <text_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <T2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <text_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <text_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_extract_path_2()`](fn@json_extract_path_2)"]
    pub type HelperType<J, T1, T2, json, text_1, text_2> =
        json_extract_path_2<J, T1, T2, <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression,
        <text_2 as AsExpression<T2>>::Expression>;
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2> Expression for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        (json, text_1, text_2): Expression {
        type SqlType = Nullable<Json>;
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        text_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>,
        text_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal>,
        text_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_extract_path";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2> QueryFragment<crate::pg::Pg>
        for json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg>,
        text_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1, text_2>(json, text_1, text_2);
    const _: () =
        {
            use diesel;
            impl<json, text_1, text_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1, text_2> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                text_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<text_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<text_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<text_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        json_extract_path_2<J, T1, T2, json, text_1, text_2> where
        __Derived<json, text_1, text_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1, text_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __json_extract_path_return_types {
    #[doc(inline)]
    pub use super::__json_extract_path_1_return_type::*;
    #[doc(inline)]
    pub use super::__json_extract_path_2_return_type::*;
}
#[doc =
" Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_extract_path_0`, `jsonb_extract_path_1`, ... `jsonb_extract_path_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_extract_path")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_extract_path_1, jsonb_extract_path_2};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected = Some(json!({\"f5\":99, \"f6\":\"foo\"}));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_1::<Jsonb, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(json!(\"foo\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_2::<Jsonb, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_extract_path_1<J: JsonbOrNullableJsonb + SingleValue,
    T1: SingleValue, json, text_1>(json: json, text_1: text_1)
    -> jsonb_extract_path_1<J, T1, json, text_1> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1> {
    jsonb_extract_path_1_utils::jsonb_extract_path_1 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_extract_path_1()`](fn@jsonb_extract_path_1)"]
pub type jsonb_extract_path_1<J, T1, json, text_1> =
    jsonb_extract_path_1_utils::jsonb_extract_path_1<J, T1,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_1_return_type {
    #[doc =
    "Return type of the [`jsonb_extract_path_1()`](fn@super::jsonb_extract_path_1) SQL function."]
    pub type jsonb_extract_path_1<json, text_1> =
        super::jsonb_extract_path_1<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType, json, text_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_extract_path_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_extract_path_1<J, T1, json, text_1> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
    }
    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<J, T1, json, text_1, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_extract_path_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_extract_path_1<J, T1, json, text_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        json: ::core::fmt::Debug, text_1: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_extract_path_1<J, T1, json, text_1> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "jsonb_extract_path_1", "json", &self.json, "text_1",
                &self.text_1, "J", &self.J, "T1", &&self.T1)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        json: ::core::clone::Clone, text_1: ::core::clone::Clone>
        ::core::clone::Clone for jsonb_extract_path_1<J, T1, json, text_1> {
        #[inline]
        fn clone(&self) -> jsonb_extract_path_1<J, T1, json, text_1> {
            jsonb_extract_path_1 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        json: ::core::marker::Copy, text_1: ::core::marker::Copy>
        ::core::marker::Copy for jsonb_extract_path_1<J, T1, json, text_1> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_extract_path_1<J, T1, json, text_1> {
                type QueryId =
                    jsonb_extract_path_1<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <json as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_extract_path_1()`](fn@jsonb_extract_path_1)"]
    pub type HelperType<J, T1, json, text_1> =
        jsonb_extract_path_1<J, T1, <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression>;
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1>
        Expression for jsonb_extract_path_1<J, T1, json, text_1> where
        (json, text_1): Expression {
        type SqlType = Nullable<Jsonb>;
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> SelectableExpression<__DieselInternal> for
        jsonb_extract_path_1<J, T1, json, text_1> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_extract_path_1<J, T1, json, text_1> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> FunctionFragment<__DieselInternal> for
        jsonb_extract_path_1<J, T1, json, text_1> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_extract_path";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1>
        QueryFragment<crate::pg::Pg> for
        jsonb_extract_path_1<J, T1, json, text_1> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1>(json, text_1);
    const _: () =
        {
            use diesel;
            impl<json, text_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue, json, text_1,
        __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_extract_path_1<J, T1, json, text_1> where
        __Derived<json, text_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_extract_path_0`, `jsonb_extract_path_1`, ... `jsonb_extract_path_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_extract_path")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_extract_path_1, jsonb_extract_path_2};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc = " let expected = Some(json!({\"f5\":99, \"f6\":\"foo\"}));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_1::<Jsonb, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(json!(\"foo\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_2::<Jsonb, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<serde_json::Value>>(connection)?;"]
#[doc = ""]
#[doc = ""]
#[doc = " assert_eq!(None::<serde_json::Value>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_extract_path_2<J: JsonbOrNullableJsonb + SingleValue,
    T1: SingleValue, T2: SingleValue, json, text_1,
    text_2>(json: json, text_1: text_1, text_2: text_2)
    -> jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1>,
    text_2: diesel::expression::AsExpression<T2> {
    jsonb_extract_path_2_utils::jsonb_extract_path_2 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        text_2: text_2.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
        T2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_extract_path_2()`](fn@jsonb_extract_path_2)"]
pub type jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> =
    jsonb_extract_path_2_utils::jsonb_extract_path_2<J, T1, T2,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression,
    <text_2 as diesel::expression::AsExpression<T2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_2_return_type {
    #[doc =
    "Return type of the [`jsonb_extract_path_2()`](fn@super::jsonb_extract_path_2) SQL function."]
    pub type jsonb_extract_path_2<json, text_1, text_2> =
        super::jsonb_extract_path_2<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType,
        <text_2 as diesel::expression::Expression>::SqlType, json, text_1,
        text_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_extract_path_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) text_2: text_2,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
        pub(in super) T2: ::core::marker::PhantomData<T2>,
    }
    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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Add<__Rhs> for
                jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Sub<__Rhs> for
                jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Mul<__Rhs> for
                jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> 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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Div<__Rhs> for
                jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        T2: ::core::fmt::Debug, json: ::core::fmt::Debug,
        text_1: ::core::fmt::Debug, text_2: ::core::fmt::Debug>
        ::core::fmt::Debug for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["json", "text_1", "text_2", "J", "T1", "T2"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.json, &self.text_1, &self.text_2, &self.J, &self.T1,
                            &&self.T2];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "jsonb_extract_path_2", names, values)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        T2: ::core::clone::Clone, json: ::core::clone::Clone,
        text_1: ::core::clone::Clone, text_2: ::core::clone::Clone>
        ::core::clone::Clone for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn clone(&self)
            -> jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
            jsonb_extract_path_2 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                text_2: ::core::clone::Clone::clone(&self.text_2),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
                T2: ::core::clone::Clone::clone(&self.T2),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        T2: ::core::marker::Copy, json: ::core::marker::Copy,
        text_1: ::core::marker::Copy, text_2: ::core::marker::Copy>
        ::core::marker::Copy for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                T2: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId,
                text_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> {
                type QueryId =
                    jsonb_extract_path_2<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <T2 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId,
                    <text_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <T2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <json as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <text_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <T2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <text_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <text_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_extract_path_2()`](fn@jsonb_extract_path_2)"]
    pub type HelperType<J, T1, T2, json, text_1, text_2> =
        jsonb_extract_path_2<J, T1, T2, <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression,
        <text_2 as AsExpression<T2>>::Expression>;
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2> Expression for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        (json, text_1, text_2): Expression {
        type SqlType = Nullable<Jsonb>;
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        text_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>,
        text_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal>,
        text_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_extract_path";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2> QueryFragment<crate::pg::Pg>
        for jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg>,
        text_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1, text_2>(json, text_1, text_2);
    const _: () =
        {
            use diesel;
            impl<json, text_1, text_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1, text_2> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                text_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<text_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<text_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<text_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue,
        T2: SingleValue, json, text_1, text_2, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_extract_path_2<J, T1, T2, json, text_1, text_2> where
        __Derived<json, text_1, text_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1, text_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_return_types {
    #[doc(inline)]
    pub use super::__jsonb_extract_path_1_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_extract_path_2_return_type::*;
}
#[doc =
" Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_extract_path_text_0`, `json_extract_path_text_1`, ... `json_extract_path_text_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_extract_path_text")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{json_extract_path_text_1, json_extract_path_text_2};"]
#[doc = " #     use diesel::sql_types::{Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let expected = Some(String::from(\"{\\\"f5\\\":99,\\\"f6\\\":\\\"foo\\\"}\"));"]
#[doc =
" let result = diesel::select(json_extract_path_text_1::<Json, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(String::from(\"foo\"));"]
#[doc =
" let result = diesel::select(json_extract_path_text_2::<Json, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_text_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_text_2::<Json, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_extract_path_text_1<J: JsonOrNullableJson + SingleValue,
    T1: SingleValue + TextOrNullableText, json,
    text_1>(json: json, text_1: text_1)
    -> json_extract_path_text_1<J, T1, json, text_1> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1> {
    json_extract_path_text_1_utils::json_extract_path_text_1 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_extract_path_text_1()`](fn@json_extract_path_text_1)"]
pub type json_extract_path_text_1<J, T1, json, text_1> =
    json_extract_path_text_1_utils::json_extract_path_text_1<J, T1,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_extract_path_text_1_return_type {
    #[doc =
    "Return type of the [`json_extract_path_text_1()`](fn@super::json_extract_path_text_1) SQL function."]
    pub type json_extract_path_text_1<json, text_1> =
        super::json_extract_path_text_1<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType, json, text_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_extract_path_text_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_extract_path_text_1<J, T1, json, text_1> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
    }
    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<J, T1, json, text_1, __Rhs> ::core::ops::Add<__Rhs> for
                json_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Sub<__Rhs> for
                json_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Mul<__Rhs> for
                json_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Div<__Rhs> for
                json_extract_path_text_1<J, T1, json, text_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        json: ::core::fmt::Debug, text_1: ::core::fmt::Debug>
        ::core::fmt::Debug for json_extract_path_text_1<J, T1, json, text_1> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "json_extract_path_text_1", "json", &self.json, "text_1",
                &self.text_1, "J", &self.J, "T1", &&self.T1)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        json: ::core::clone::Clone, text_1: ::core::clone::Clone>
        ::core::clone::Clone for json_extract_path_text_1<J, T1, json, text_1>
        {
        #[inline]
        fn clone(&self) -> json_extract_path_text_1<J, T1, json, text_1> {
            json_extract_path_text_1 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        json: ::core::marker::Copy, text_1: ::core::marker::Copy>
        ::core::marker::Copy for json_extract_path_text_1<J, T1, json, text_1>
        {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_extract_path_text_1<J, T1, json, text_1> {
                type QueryId =
                    json_extract_path_text_1<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <json as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_extract_path_text_1()`](fn@json_extract_path_text_1)"]
    pub type HelperType<J, T1, json, text_1> =
        json_extract_path_text_1<J, T1, <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression>;
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1> Expression for
        json_extract_path_text_1<J, T1, json, text_1> where
        (json, text_1): Expression {
        type SqlType = Nullable<Text>;
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_extract_path_text_1<J, T1, json, text_1> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        json_extract_path_text_1<J, T1, json, text_1> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        json_extract_path_text_1<J, T1, json, text_1> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_extract_path_text";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1> QueryFragment<crate::pg::Pg> for
        json_extract_path_text_1<J, T1, json, text_1> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1>(json, text_1);
    const _: () =
        {
            use diesel;
            impl<json, text_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        json_extract_path_text_1<J, T1, json, text_1> where
        __Derived<json, text_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`json_extract_path_text_0`, `json_extract_path_text_1`, ... `json_extract_path_text_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "json_extract_path_text")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{json_extract_path_text_1, json_extract_path_text_2};"]
#[doc = " #     use diesel::sql_types::{Json, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let expected = Some(String::from(\"{\\\"f5\\\":99,\\\"f6\\\":\\\"foo\\\"}\"));"]
#[doc =
" let result = diesel::select(json_extract_path_text_1::<Json, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(String::from(\"foo\"));"]
#[doc =
" let result = diesel::select(json_extract_path_text_2::<Json, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_text_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(json_extract_path_text_2::<Json, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn json_extract_path_text_2<J: JsonOrNullableJson + SingleValue,
    T1: SingleValue + TextOrNullableText, T2: SingleValue +
    TextOrNullableText, json, text_1,
    text_2>(json: json, text_1: text_1, text_2: text_2)
    -> json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1>,
    text_2: diesel::expression::AsExpression<T2> {
    json_extract_path_text_2_utils::json_extract_path_text_2 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        text_2: text_2.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
        T2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`json_extract_path_text_2()`](fn@json_extract_path_text_2)"]
pub type json_extract_path_text_2<J, T1, T2, json, text_1, text_2> =
    json_extract_path_text_2_utils::json_extract_path_text_2<J, T1, T2,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression,
    <text_2 as diesel::expression::AsExpression<T2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __json_extract_path_text_2_return_type {
    #[doc =
    "Return type of the [`json_extract_path_text_2()`](fn@super::json_extract_path_text_2) SQL function."]
    pub type json_extract_path_text_2<json, text_1, text_2> =
        super::json_extract_path_text_2<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType,
        <text_2 as diesel::expression::Expression>::SqlType, json, text_1,
        text_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod json_extract_path_text_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) text_2: text_2,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
        pub(in super) T2: ::core::marker::PhantomData<T2>,
    }
    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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Add<__Rhs> for
                json_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Sub<__Rhs> for
                json_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Mul<__Rhs> for
                json_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Div<__Rhs> for
                json_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        T2: ::core::fmt::Debug, json: ::core::fmt::Debug,
        text_1: ::core::fmt::Debug, text_2: ::core::fmt::Debug>
        ::core::fmt::Debug for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["json", "text_1", "text_2", "J", "T1", "T2"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.json, &self.text_1, &self.text_2, &self.J, &self.T1,
                            &&self.T2];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "json_extract_path_text_2", names, values)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        T2: ::core::clone::Clone, json: ::core::clone::Clone,
        text_1: ::core::clone::Clone, text_2: ::core::clone::Clone>
        ::core::clone::Clone for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn clone(&self)
            -> json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
            json_extract_path_text_2 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                text_2: ::core::clone::Clone::clone(&self.text_2),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
                T2: ::core::clone::Clone::clone(&self.T2),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        T2: ::core::marker::Copy, json: ::core::marker::Copy,
        text_1: ::core::marker::Copy, text_2: ::core::marker::Copy>
        ::core::marker::Copy for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                T2: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId,
                text_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                json_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
                type QueryId =
                    json_extract_path_text_2<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <T2 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId,
                    <text_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <T2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <json as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <text_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <T2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <text_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <text_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`json_extract_path_text_2()`](fn@json_extract_path_text_2)"]
    pub type HelperType<J, T1, T2, json, text_1, text_2> =
        json_extract_path_text_2<J, T1, T2,
        <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression,
        <text_2 as AsExpression<T2>>::Expression>;
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2> Expression for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        (json, text_1, text_2): Expression {
        type SqlType = Nullable<Text>;
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        text_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> AppearsOnTable<__DieselInternal> for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>,
        text_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> FunctionFragment<__DieselInternal>
        for json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal>,
        text_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "json_extract_path_text";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2> QueryFragment<crate::pg::Pg> for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg>,
        text_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1, text_2>(json, text_1, text_2);
    const _: () =
        {
            use diesel;
            impl<json, text_1, text_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1, text_2> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                text_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<text_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<text_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<text_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonOrNullableJson + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> ValidGrouping<__DieselInternal> for
        json_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        __Derived<json, text_1, text_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1, text_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __json_extract_path_text_return_types {
    #[doc(inline)]
    pub use super::__json_extract_path_text_1_return_type::*;
    #[doc(inline)]
    pub use super::__json_extract_path_text_2_return_type::*;
}
#[doc =
" Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_extract_path_text_0`, `jsonb_extract_path_text_1`, ... `jsonb_extract_path_text_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_extract_path_text")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_extract_path_text_1, jsonb_extract_path_text_2};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let expected = Some(String::from(\"{\\\"f5\\\": 99, \\\"f6\\\": \\\"foo\\\"}\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_1::<Jsonb, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(String::from(\"foo\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_extract_path_text_1<J: JsonbOrNullableJsonb + SingleValue,
    T1: SingleValue + TextOrNullableText, json,
    text_1>(json: json, text_1: text_1)
    -> jsonb_extract_path_text_1<J, T1, json, text_1> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1> {
    jsonb_extract_path_text_1_utils::jsonb_extract_path_text_1 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_extract_path_text_1()`](fn@jsonb_extract_path_text_1)"]
pub type jsonb_extract_path_text_1<J, T1, json, text_1> =
    jsonb_extract_path_text_1_utils::jsonb_extract_path_text_1<J, T1,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_text_1_return_type {
    #[doc =
    "Return type of the [`jsonb_extract_path_text_1()`](fn@super::jsonb_extract_path_text_1) SQL function."]
    pub type jsonb_extract_path_text_1<json, text_1> =
        super::jsonb_extract_path_text_1<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType, json, text_1>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_extract_path_text_1_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_extract_path_text_1<J, T1, json, text_1> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
    }
    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<J, T1, json, text_1, __Rhs> ::core::ops::Add<__Rhs> for
                jsonb_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Sub<__Rhs> for
                jsonb_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Mul<__Rhs> for
                jsonb_extract_path_text_1<J, T1, json, text_1> 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<J, T1, json, text_1, __Rhs> ::core::ops::Div<__Rhs> for
                jsonb_extract_path_text_1<J, T1, json, text_1> 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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        json: ::core::fmt::Debug, text_1: ::core::fmt::Debug>
        ::core::fmt::Debug for jsonb_extract_path_text_1<J, T1, json, text_1>
        {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            ::core::fmt::Formatter::debug_struct_field4_finish(f,
                "jsonb_extract_path_text_1", "json", &self.json, "text_1",
                &self.text_1, "J", &self.J, "T1", &&self.T1)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        json: ::core::clone::Clone, text_1: ::core::clone::Clone>
        ::core::clone::Clone for
        jsonb_extract_path_text_1<J, T1, json, text_1> {
        #[inline]
        fn clone(&self) -> jsonb_extract_path_text_1<J, T1, json, text_1> {
            jsonb_extract_path_text_1 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        json: ::core::marker::Copy, text_1: ::core::marker::Copy>
        ::core::marker::Copy for
        jsonb_extract_path_text_1<J, T1, json, text_1> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_extract_path_text_1<J, T1, json, text_1> {
                type QueryId =
                    jsonb_extract_path_text_1<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                &&
                                <json as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_1 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                    <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                            ||
                            <text_1 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_extract_path_text_1()`](fn@jsonb_extract_path_text_1)"]
    pub type HelperType<J, T1, json, text_1> =
        jsonb_extract_path_text_1<J, T1,
        <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression>;
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1> Expression for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        (json, text_1): Expression {
        type SqlType = Nullable<Text>;
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        AppearsOnTable<__DieselInternal> for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        FunctionFragment<__DieselInternal> for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_extract_path_text";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1> QueryFragment<crate::pg::Pg> for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1>(json, text_1);
    const _: () =
        {
            use diesel;
            impl<json, text_1, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, json, text_1, __DieselInternal>
        ValidGrouping<__DieselInternal> for
        jsonb_extract_path_text_1<J, T1, json, text_1> where
        __Derived<json, text_1>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[doc =
" Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)"]
#[doc = ""]
#[doc = " # Example"]
#[doc = ""]
#[doc = r""]
#[doc = r" # Variadic functions"]
#[doc = r""]
#[doc =
r" This function is variadic in SQL, so there's a family of functions"]
#[doc = r" on a diesel side:"]
#[doc = r""]
#[doc =
"`jsonb_extract_path_text_0`, `jsonb_extract_path_text_1`, ... `jsonb_extract_path_text_n`"]
#[doc = r""]
#[doc =
r" Here, the postfix number indicates repetitions of variadic arguments."]
#[doc = r" To use this function, the appropriate version with the correct"]
#[doc = r" argument count must be selected."]
#[doc = r""]
#[doc = r" ## Controlling the generation of variadic function variants"]
#[doc = r""]
#[doc =
r" By default, only variants with 0, 1, and 2 repetitions of variadic"]
#[doc = r" arguments are generated. To generate more variants, set the"]
#[doc =
r" `DIESEL_VARIADIC_FUNCTION_ARGS` environment variable to the desired"]
#[doc = r" number of variants."]
#[doc = r""]
#[doc =
r" For a greater convenience this environment variable can also be set"]
#[doc = r" in a `.cargo/config.toml` file as described in the"]
#[doc =
r" [cargo documentation](https://doc.rust-lang.org/cargo/reference/config.html#env)."]
#[doc(alias = "jsonb_extract_path_text")]
#[doc = " ```rust"]
#[doc = " # include!(\"../../doctest_setup.rs\");"]
#[doc = " #"]
#[doc = " # fn main() {"]
#[doc = " #     #[cfg(feature = \"serde_json\")]"]
#[doc = " #     run_test().unwrap();"]
#[doc = " # }"]
#[doc = " #"]
#[doc = " # #[cfg(feature = \"serde_json\")]"]
#[doc = " # fn run_test() -> QueryResult<()> {"]
#[doc =
" #     use diesel::dsl::{jsonb_extract_path_text_1, jsonb_extract_path_text_2};"]
#[doc = " #     use diesel::sql_types::{Jsonb, Nullable, Text};"]
#[doc = " #     use serde_json::{json,Value};"]
#[doc = " #     use diesel::dsl::sql;"]
#[doc = " #     let connection = &mut establish_connection();"]
#[doc = ""]
#[doc =
" let expected = Some(String::from(\"{\\\"f5\\\": 99, \\\"f6\\\": \\\"foo\\\"}\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_1::<Jsonb, Text, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc = " let expected = Some(String::from(\"foo\"));"]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Text, Text, _, _, _>("]
#[doc = "     json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}),"]
#[doc = "     \"f4\","]
#[doc = "     \"f6\""]
#[doc = " ))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(expected, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, \"f4\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc =
" let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({\"f2\":{\"f3\":1},\"f4\":{\"f5\":99,\"f6\":\"foo\"}}), None::<String>, \"f6\"))"]
#[doc = " .get_result::<Option<String>>(connection)?;"]
#[doc = ""]
#[doc = " assert_eq!(None::<String>, result);"]
#[doc = ""]
#[doc = " #     Ok(())"]
#[doc = " # }"]
#[doc = " ```"]
#[allow(non_camel_case_types)]
pub fn jsonb_extract_path_text_2<J: JsonbOrNullableJsonb + SingleValue,
    T1: SingleValue + TextOrNullableText, T2: SingleValue +
    TextOrNullableText, json, text_1,
    text_2>(json: json, text_1: text_1, text_2: text_2)
    -> jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
    json: diesel::expression::AsExpression<J>,
    text_1: diesel::expression::AsExpression<T1>,
    text_2: diesel::expression::AsExpression<T2> {
    jsonb_extract_path_text_2_utils::jsonb_extract_path_text_2 {
        json: json.as_expression(),
        text_1: text_1.as_expression(),
        text_2: text_2.as_expression(),
        J: ::core::marker::PhantomData,
        T1: ::core::marker::PhantomData,
        T2: ::core::marker::PhantomData,
    }
}
#[allow(non_camel_case_types, non_snake_case)]
#[doc =
"The return type of [`jsonb_extract_path_text_2()`](fn@jsonb_extract_path_text_2)"]
pub type jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> =
    jsonb_extract_path_text_2_utils::jsonb_extract_path_text_2<J, T1, T2,
    <json as diesel::expression::AsExpression<J>>::Expression,
    <text_1 as diesel::expression::AsExpression<T1>>::Expression,
    <text_2 as diesel::expression::AsExpression<T2>>::Expression>;
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_text_2_return_type {
    #[doc =
    "Return type of the [`jsonb_extract_path_text_2()`](fn@super::jsonb_extract_path_text_2) SQL function."]
    pub type jsonb_extract_path_text_2<json, text_1, text_2> =
        super::jsonb_extract_path_text_2<<json as
        diesel::expression::Expression>::SqlType,
        <text_1 as diesel::expression::Expression>::SqlType,
        <text_2 as diesel::expression::Expression>::SqlType, json, text_1,
        text_2>;
}
#[doc(hidden)]
#[allow(non_camel_case_types, non_snake_case, unused_imports)]
pub(crate) mod jsonb_extract_path_text_2_utils {
    use diesel::{self, QueryResult};
    use diesel::expression::{
        AsExpression, Expression, SelectableExpression, AppearsOnTable,
        ValidGrouping,
    };
    use diesel::query_builder::{QueryFragment, AstPass};
    use diesel::sql_types::*;
    use diesel::internal::sql_functions::*;
    use super::*;
    pub struct jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        pub(in super) json: json,
        pub(in super) text_1: text_1,
        pub(in super) text_2: text_2,
        pub(in super) J: ::core::marker::PhantomData<J>,
        pub(in super) T1: ::core::marker::PhantomData<T1>,
        pub(in super) T2: ::core::marker::PhantomData<T2>,
    }
    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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Add<__Rhs> for
                jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Sub<__Rhs> for
                jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Mul<__Rhs> for
                jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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<J, T1, T2, json, text_1, text_2, __Rhs>
                ::core::ops::Div<__Rhs> for
                jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2>
                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())
                }
            }
        };
    #[automatically_derived]
    impl<J: ::core::fmt::Debug, T1: ::core::fmt::Debug,
        T2: ::core::fmt::Debug, json: ::core::fmt::Debug,
        text_1: ::core::fmt::Debug, text_2: ::core::fmt::Debug>
        ::core::fmt::Debug for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
            let names: &'static _ =
                &["json", "text_1", "text_2", "J", "T1", "T2"];
            let values: &[&dyn ::core::fmt::Debug] =
                &[&self.json, &self.text_1, &self.text_2, &self.J, &self.T1,
                            &&self.T2];
            ::core::fmt::Formatter::debug_struct_fields_finish(f,
                "jsonb_extract_path_text_2", names, values)
        }
    }
    #[automatically_derived]
    impl<J: ::core::clone::Clone, T1: ::core::clone::Clone,
        T2: ::core::clone::Clone, json: ::core::clone::Clone,
        text_1: ::core::clone::Clone, text_2: ::core::clone::Clone>
        ::core::clone::Clone for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
        #[inline]
        fn clone(&self)
            -> jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
            jsonb_extract_path_text_2 {
                json: ::core::clone::Clone::clone(&self.json),
                text_1: ::core::clone::Clone::clone(&self.text_1),
                text_2: ::core::clone::Clone::clone(&self.text_2),
                J: ::core::clone::Clone::clone(&self.J),
                T1: ::core::clone::Clone::clone(&self.T1),
                T2: ::core::clone::Clone::clone(&self.T2),
            }
        }
    }
    #[automatically_derived]
    impl<J: ::core::marker::Copy, T1: ::core::marker::Copy,
        T2: ::core::marker::Copy, json: ::core::marker::Copy,
        text_1: ::core::marker::Copy, text_2: ::core::marker::Copy>
        ::core::marker::Copy for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
    }
    const _: () =
        {
            use diesel;
            #[allow(non_camel_case_types)]
            impl<J: diesel::query_builder::QueryId,
                T1: diesel::query_builder::QueryId,
                T2: diesel::query_builder::QueryId,
                json: diesel::query_builder::QueryId,
                text_1: diesel::query_builder::QueryId,
                text_2: diesel::query_builder::QueryId>
                diesel::query_builder::QueryId for
                jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> {
                type QueryId =
                    jsonb_extract_path_text_2<<J as
                    diesel::query_builder::QueryId>::QueryId,
                    <T1 as diesel::query_builder::QueryId>::QueryId,
                    <T2 as diesel::query_builder::QueryId>::QueryId,
                    <json as diesel::query_builder::QueryId>::QueryId,
                    <text_1 as diesel::query_builder::QueryId>::QueryId,
                    <text_2 as diesel::query_builder::QueryId>::QueryId>;
                const HAS_STATIC_QUERY_ID: bool =
                    <J as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                            &&
                                            <T1 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                        &&
                                        <T2 as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                                    &&
                                    <json as
                                        diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                                <text_1 as
                                    diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                            <text_2 as
                                diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                        true;
                const IS_WINDOW_FUNCTION: bool =
                    <J as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                                            <T1 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                        ||
                                        <T2 as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                    ||
                                    <json as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                                ||
                                <text_1 as
                                    diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                            <text_2 as
                                diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                        false;
            }
        };
    #[doc =
    "The return type of [`jsonb_extract_path_text_2()`](fn@jsonb_extract_path_text_2)"]
    pub type HelperType<J, T1, T2, json, text_1, text_2> =
        jsonb_extract_path_text_2<J, T1, T2,
        <json as AsExpression<J>>::Expression,
        <text_1 as AsExpression<T1>>::Expression,
        <text_2 as AsExpression<T2>>::Expression>;
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2> Expression for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        (json, text_1, text_2): Expression {
        type SqlType = Nullable<Text>;
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal>
        SelectableExpression<__DieselInternal> for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: SelectableExpression<__DieselInternal>,
        text_1: SelectableExpression<__DieselInternal>,
        text_2: SelectableExpression<__DieselInternal>,
        Self: AppearsOnTable<__DieselInternal> {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> AppearsOnTable<__DieselInternal> for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: AppearsOnTable<__DieselInternal>,
        text_1: AppearsOnTable<__DieselInternal>,
        text_2: AppearsOnTable<__DieselInternal>, Self: Expression {}
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> FunctionFragment<__DieselInternal>
        for jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        __DieselInternal: diesel::backend::Backend,
        json: QueryFragment<__DieselInternal>,
        text_1: QueryFragment<__DieselInternal>,
        text_2: QueryFragment<__DieselInternal> {
        const FUNCTION_NAME: &'static str = "jsonb_extract_path_text";
        #[allow(unused_assignments)]
        fn walk_arguments<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, __DieselInternal>) -> QueryResult<()> {
            let mut needs_comma = false;
            if !self.json.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.json.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_1.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_1.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            if !self.text_2.is_noop(out.backend())? {
                if needs_comma { out.push_sql(", "); }
                self.text_2.walk_ast(out.reborrow())?;
                needs_comma = true;
            }
            Ok(())
        }
    }
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2> QueryFragment<crate::pg::Pg> for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        json: QueryFragment<crate::pg::Pg>,
        text_1: QueryFragment<crate::pg::Pg>,
        text_2: QueryFragment<crate::pg::Pg> {
        fn walk_ast<'__b>(&'__b self,
            mut out: AstPass<'_, '__b, crate::pg::Pg>) -> QueryResult<()> {
            out.push_sql(<Self as
                    FunctionFragment<crate::pg::Pg>>::FUNCTION_NAME);
            out.push_sql("(");
            self.walk_arguments(out.reborrow())?;
            out.push_sql(")");
            Ok(())
        }
    }
    pub struct __Derived<json, text_1, text_2>(json, text_1, text_2);
    const _: () =
        {
            use diesel;
            impl<json, text_1, text_2, __GroupByClause>
                diesel::expression::ValidGrouping<__GroupByClause> for
                __Derived<json, text_1, text_2> where
                json: diesel::expression::ValidGrouping<__GroupByClause>,
                text_1: diesel::expression::ValidGrouping<__GroupByClause>,
                text_2: diesel::expression::ValidGrouping<__GroupByClause>,
                <json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate: diesel::expression::MixedAggregates<<text_1
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>,
                <<json as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                as
                diesel::expression::MixedAggregates<<text_1 as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output: diesel::expression::MixedAggregates<<text_2
                as
                diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>
                {
                type IsAggregate =
                    <<<json as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate
                    as
                    diesel::expression::MixedAggregates<<text_1 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output
                    as
                    diesel::expression::MixedAggregates<<text_2 as
                    diesel::expression::ValidGrouping<__GroupByClause>>::IsAggregate>>::Output;
            }
        };
    impl<J: JsonbOrNullableJsonb + SingleValue, T1: SingleValue +
        TextOrNullableText, T2: SingleValue + TextOrNullableText, json,
        text_1, text_2, __DieselInternal> ValidGrouping<__DieselInternal> for
        jsonb_extract_path_text_2<J, T1, T2, json, text_1, text_2> where
        __Derived<json, text_1, text_2>: ValidGrouping<__DieselInternal> {
        type IsAggregate =
            <__Derived<json, text_1, text_2> as
            ValidGrouping<__DieselInternal>>::IsAggregate;
    }
}
#[allow(unused_imports)]
#[doc(inline)]
mod __jsonb_extract_path_text_return_types {
    #[doc(inline)]
    pub use super::__jsonb_extract_path_text_1_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_extract_path_text_2_return_type::*;
}
#[allow(unused_imports)]
#[doc(hidden)]
mod return_type_helpers {
    #[doc(inline)]
    pub use super::__abbrev_return_type::*;
    #[doc(inline)]
    pub use super::__broadcast_return_type::*;
    #[doc(inline)]
    pub use super::__family_return_type::*;
    #[doc(inline)]
    pub use super::__host_return_type::*;
    #[doc(inline)]
    pub use super::__hostmask_return_type::*;
    #[doc(inline)]
    pub use super::__inet_merge_return_type::*;
    #[doc(inline)]
    pub use super::__inet_same_family_return_type::*;
    #[doc(inline)]
    pub use super::__masklen_return_type::*;
    #[doc(inline)]
    pub use super::__netmask_return_type::*;
    #[doc(inline)]
    pub use super::__network_return_type::*;
    #[doc(inline)]
    pub use super::__set_masklen_return_type::*;
    #[doc(inline)]
    pub use super::__lower_return_type::*;
    #[doc(inline)]
    pub use super::__upper_return_type::*;
    #[doc(inline)]
    pub use super::__isempty_return_type::*;
    #[doc(inline)]
    pub use super::__lower_inc_return_type::*;
    #[doc(inline)]
    pub use super::__upper_inc_return_type::*;
    #[doc(inline)]
    pub use super::__lower_inf_return_type::*;
    #[doc(inline)]
    pub use super::__upper_inf_return_type::*;
    #[doc(inline)]
    pub use super::__range_merge_return_type::*;
    #[doc(inline)]
    pub use super::__multirange_merge_return_type::*;
    #[doc(inline)]
    pub use super::__int4range_return_type::*;
    #[doc(inline)]
    pub use super::__int8range_return_type::*;
    #[doc(inline)]
    pub use super::__numrange_return_type::*;
    #[doc(inline)]
    pub use super::__tsrange_return_type::*;
    #[doc(inline)]
    pub use super::__tstzrange_return_type::*;
    #[doc(inline)]
    pub use super::__daterange_return_type::*;
    #[doc(inline)]
    pub use super::__array_append_return_type::*;
    #[doc(inline)]
    pub use super::__array_replace_return_type::*;
    #[doc(inline)]
    pub use super::__array_dims_return_type::*;
    #[doc(inline)]
    pub use super::__array_prepend_return_type::*;
    #[doc(inline)]
    pub use super::__array_remove_return_type::*;
    #[doc(inline)]
    pub use super::__array_to_string_with_null_string_return_type::*;
    #[doc(inline)]
    pub use super::__array_to_string_return_type::*;
    #[doc(inline)]
    pub use super::__cardinality_return_type::*;
    #[doc(inline)]
    pub use super::__trim_array_return_type::*;
    #[doc(inline)]
    pub use super::__array_cat_return_type::*;
    #[doc(inline)]
    pub use super::__array_length_return_type::*;
    #[doc(inline)]
    pub use super::__array_fill_return_type::*;
    #[doc(inline)]
    pub use super::__array_fill_with_lower_bound_return_type::*;
    #[doc(inline)]
    pub use super::__array_lower_return_type::*;
    #[doc(inline)]
    pub use super::__array_position_return_type::*;
    #[doc(inline)]
    pub use super::__array_position_with_subscript_return_type::*;
    #[doc(inline)]
    pub use super::__array_positions_return_type::*;
    #[doc(inline)]
    pub use super::__array_ndims_return_type::*;
    #[doc(inline)]
    pub use super::__array_upper_return_type::*;
    #[doc(inline)]
    pub use super::__array_shuffle_return_type::*;
    #[doc(inline)]
    pub use super::__array_sample_return_type::*;
    #[doc(inline)]
    pub use super::__array_to_json_return_type::*;
    #[doc(inline)]
    pub use super::__to_json_return_type::*;
    #[doc(inline)]
    pub use super::__to_jsonb_return_type::*;
    #[doc(inline)]
    pub use super::__json_object_return_type::*;
    #[doc(inline)]
    pub use super::__json_object_with_keys_and_values_return_type::*;
    #[doc(inline)]
    pub use super::__json_typeof_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_typeof_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_pretty_return_type::*;
    #[doc(inline)]
    pub use super::__json_strip_nulls_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_strip_nulls_return_type::*;
    #[doc(inline)]
    pub use super::__json_array_length_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_array_length_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_object_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_object_with_keys_and_values_return_type::*;
    #[doc(inline)]
    pub use super::__row_to_json_return_type::*;
    #[doc(inline)]
    pub use super::__json_populate_record_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_populate_record_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_set_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_set_create_if_missing_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_set_lax_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_insert_return_type::*;
    #[doc(inline)]
    pub use super::__jsonb_insert_with_insert_after_return_type::*;
    #[doc(inline)]
    pub use super::__json_build_array_return_types::*;
    #[doc(inline)]
    pub use super::__jsonb_build_array_return_types::*;
    #[doc(inline)]
    pub use super::__json_extract_path_return_types::*;
    #[doc(inline)]
    pub use super::__jsonb_extract_path_return_types::*;
    #[doc(inline)]
    pub use super::__json_extract_path_text_return_types::*;
    #[doc(inline)]
    pub use super::__jsonb_extract_path_text_return_types::*;
}#[declare_sql_function(generate_return_type_helpers = true)]
20#[backends(crate::pg::Pg)]
21extern "SQL" {
22    /// Creates an abbreviated display format as text.
23    #[cfg(feature = "postgres_backend")]
24    fn abbrev<T: InetOrCidr + SingleValue>(addr: T) -> Text;
25
26    /// Computes the broadcast address for the address's network.
27    #[cfg(feature = "postgres_backend")]
28    fn broadcast<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
29
30    /// Returns the address's family: 4 for IPv4, 6 for IPv6.
31    #[cfg(feature = "postgres_backend")]
32    fn family<T: InetOrCidr + SingleValue>(addr: T) -> Integer;
33
34    /// Returns the IP address as text, ignoring the netmask.
35    #[cfg(feature = "postgres_backend")]
36    fn host<T: InetOrCidr + SingleValue>(addr: T) -> Text;
37
38    /// Computes the host mask for the address's network.
39    #[cfg(feature = "postgres_backend")]
40    fn hostmask<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
41
42    /// Computes the smallest network that includes both of the given networks.
43    #[cfg(feature = "postgres_backend")]
44    fn inet_merge<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue>(a: T, b: U) -> Cidr;
45
46    /// Tests whether the addresses belong to the same IP family.
47    #[cfg(feature = "postgres_backend")]
48    fn inet_same_family<T: InetOrCidr + SingleValue, U: InetOrCidr + SingleValue>(
49        a: T,
50        b: U,
51    ) -> Bool;
52
53    /// Returns the netmask length in bits.
54    #[cfg(feature = "postgres_backend")]
55    fn masklen<T: InetOrCidr + SingleValue>(addr: T) -> Integer;
56
57    /// Computes the network mask for the address's network.
58    #[cfg(feature = "postgres_backend")]
59    fn netmask<T: InetOrCidr + SingleValue>(addr: T) -> Inet;
60
61    /// Returns the network part of the address, zeroing out whatever is to the right of the
62    /// netmask. (This is equivalent to casting the value to cidr.)
63    #[cfg(feature = "postgres_backend")]
64    fn network<T: InetOrCidr + SingleValue>(addr: T) -> Cidr;
65
66    /// Sets the netmask length for an inet or cidr value.
67    /// For inet, the address part does not changes. For cidr, address bits to the right of the new
68    /// netmask are set to zero.
69    #[cfg(feature = "postgres_backend")]
70    fn set_masklen<T: InetOrCidr + SingleValue>(addr: T, len: Integer) -> T;
71
72    /// Returns the lower bound of the range
73    ///
74    /// If the range is empty or has no lower bound, it returns NULL.
75    ///
76    /// # Example
77    ///
78    /// ```rust
79    /// # include!("../../doctest_setup.rs");
80    /// #
81    /// # fn main() {
82    /// #     run_test().unwrap();
83    /// # }
84    /// #
85    /// # fn run_test() -> QueryResult<()> {
86    /// # use diesel::pg::sql_types::{Range, Multirange};
87    /// # use diesel::dsl::lower;
88    /// #     use std::collections::Bound;
89    /// #     use diesel::sql_types::{Nullable, Integer, Array};
90    /// #     let connection = &mut establish_connection();
91    /// let int = diesel::select(lower::<Range<_>, _>(1..2)).get_result::<Option<i32>>(connection)?;
92    /// assert_eq!(Some(1), int);
93    ///
94    /// let int = diesel::select(lower::<Range<_>, _>(..2)).get_result::<Option<i32>>(connection)?;
95    /// assert_eq!(None, int);
96    ///
97    /// let int = diesel::select(lower::<Nullable<Range<_>>, _>(None::<std::ops::Range<i32>>))
98    ///     .get_result::<Option<i32>>(connection)?;
99    /// assert_eq!(None, int);
100    ///
101    /// let int = diesel::select(lower::<Multirange<_>, _>(vec![5..7]))
102    ///     .get_result::<Option<i32>>(connection)?;
103    /// assert_eq!(Some(5), int);
104    /// #     Ok(())
105    /// # }
106    /// ```
107    #[cfg(feature = "postgres_backend")]
108    fn lower<R: MultirangeOrRangeMaybeNullable + SingleValue>(range: R) -> Nullable<R::Inner>;
109
110    /// Returns the upper bound of the range
111    ///
112    /// If the range is empty or has no upper bound, it returns NULL.
113    ///
114    /// # Example
115    ///
116    /// ```rust
117    /// # include!("../../doctest_setup.rs");
118    /// #
119    /// # fn main() {
120    /// #     run_test().unwrap();
121    /// # }
122    /// #
123    /// # fn run_test() -> QueryResult<()> {
124    /// # use diesel::pg::sql_types::{Range, Multirange};
125    /// # use diesel::dsl::upper;
126    /// #     use std::collections::Bound;
127    /// #     use diesel::sql_types::{Nullable, Integer, Array};
128    /// #     let connection = &mut establish_connection();
129    /// let int = diesel::select(upper::<Range<_>, _>(1..2)).get_result::<Option<i32>>(connection)?;
130    /// assert_eq!(Some(2), int);
131    ///
132    /// let int = diesel::select(upper::<Range<_>, _>(1..)).get_result::<Option<i32>>(connection)?;
133    /// assert_eq!(None, int);
134    ///
135    /// let int = diesel::select(upper::<Nullable<Range<_>>, _>(None::<std::ops::Range<i32>>))
136    ///     .get_result::<Option<i32>>(connection)?;
137    /// assert_eq!(None, int);
138    ///
139    /// let int = diesel::select(upper::<Multirange<_>, _>(vec![5..7]))
140    ///     .get_result::<Option<i32>>(connection)?;
141    /// assert_eq!(Some(7), int);
142    /// #     Ok(())
143    /// # }
144    /// ```
145    #[cfg(feature = "postgres_backend")]
146    fn upper<R: MultirangeOrRangeMaybeNullable + SingleValue>(range: R) -> Nullable<R::Inner>;
147
148    /// Returns true if the range is empty
149    ///
150    /// # Example
151    ///
152    /// ```rust
153    /// # include!("../../doctest_setup.rs");
154    /// #
155    /// # fn main() {
156    /// #     run_test().unwrap();
157    /// # }
158    /// #
159    /// # fn run_test() -> QueryResult<()> {
160    /// # use diesel::pg::sql_types::{Range, Multirange};
161    /// # use diesel::dsl::isempty;
162    /// #     use std::collections::Bound;
163    /// #     use diesel::sql_types::{Nullable, Integer, Array};
164    /// #     let connection = &mut establish_connection();
165    /// let int = diesel::select(isempty::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;
166    /// assert_eq!(false, int);
167    ///
168    /// let int = diesel::select(isempty::<Range<Integer>, _>(1..1)).get_result::<bool>(connection)?;
169    /// assert_eq!(true, int);
170    ///
171    /// let int = diesel::select(isempty::<Nullable<Range<Integer>>, _>(
172    ///     None::<std::ops::Range<i32>>,
173    /// ))
174    /// .get_result::<Option<bool>>(connection)?;
175    /// assert_eq!(None, int);
176    ///
177    /// let int = diesel::select(isempty::<Multirange<Integer>, _>(vec![5..7]))
178    ///     .get_result::<bool>(connection)?;
179    /// assert_eq!(false, int);
180    /// #     Ok(())
181    /// # }
182    /// ```
183    #[cfg(feature = "postgres_backend")]
184    fn isempty<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>>(
185        range: R,
186    ) -> R::Out;
187
188    /// Returns true if the range's lower bound is inclusive
189    ///
190    /// # Example
191    ///
192    /// ```rust
193    /// # include!("../../doctest_setup.rs");
194    /// #
195    /// # fn main() {
196    /// #     run_test().unwrap();
197    /// # }
198    /// #
199    /// # fn run_test() -> QueryResult<()> {
200    /// # use diesel::pg::sql_types::{Range, Multirange};
201    /// # use diesel::dsl::lower_inc;
202    /// #     use std::collections::Bound;
203    /// #     use diesel::sql_types::{Nullable, Integer, Array};
204    /// #     let connection = &mut establish_connection();
205    /// let int =
206    ///     diesel::select(lower_inc::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;
207    /// assert_eq!(true, int);
208    ///
209    /// let int = diesel::select(lower_inc::<Range<Integer>, _>(..5)).get_result::<bool>(connection)?;
210    /// assert_eq!(false, int);
211    ///
212    /// let int = diesel::select(lower_inc::<Nullable<Range<Integer>>, _>(
213    ///     None::<std::ops::Range<i32>>,
214    /// ))
215    /// .get_result::<Option<bool>>(connection)?;
216    /// assert_eq!(None, int);
217    ///
218    /// let int = diesel::select(lower_inc::<Multirange<Integer>, _>(vec![5..7]))
219    ///     .get_result::<bool>(connection)?;
220    /// assert_eq!(true, int);
221    /// #     Ok(())
222    /// # }
223    /// ```
224    #[cfg(feature = "postgres_backend")]
225    fn lower_inc<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>>(
226        range: R,
227    ) -> R::Out;
228
229    /// Returns true if the range's upper bound is inclusive
230    ///
231    /// # Example
232    ///
233    /// ```rust
234    /// # include!("../../doctest_setup.rs");
235    /// #
236    /// # fn main() {
237    /// #     run_test().unwrap();
238    /// # }
239    /// #
240    /// # fn run_test() -> QueryResult<()> {
241    /// # use diesel::pg::sql_types::{Range, Multirange};
242    /// # use diesel::dsl::upper_inc;
243    /// #     use std::collections::Bound;
244    /// #     use diesel::sql_types::{Nullable, Integer, Array};
245    /// #     let connection = &mut establish_connection();
246    /// let int =
247    ///     diesel::select(upper_inc::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;
248    /// assert_eq!(false, int);
249    ///
250    /// let int = diesel::select(upper_inc::<Nullable<Range<Integer>>, _>(
251    ///     None::<std::ops::Range<i32>>,
252    /// ))
253    /// .get_result::<Option<bool>>(connection)?;
254    /// assert_eq!(None, int);
255    ///
256    /// let int = diesel::select(upper_inc::<Multirange<Integer>, _>(vec![5..7]))
257    ///     .get_result::<bool>(connection)?;
258    /// assert_eq!(false, int);
259    /// #     Ok(())
260    /// # }
261    /// ```
262    #[cfg(feature = "postgres_backend")]
263    fn upper_inc<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>>(
264        range: R,
265    ) -> R::Out;
266
267    /// Returns true if the range's lower bound is unbounded
268    ///
269    /// # Example
270    ///
271    /// ```rust
272    /// # include!("../../doctest_setup.rs");
273    /// #
274    /// # fn main() {
275    /// #     run_test().unwrap();
276    /// # }
277    /// #
278    /// # fn run_test() -> QueryResult<()> {
279    /// # use diesel::pg::sql_types::{Range, Multirange};
280    /// # use diesel::dsl::lower_inf;
281    /// #     use std::collections::Bound;
282    /// #     use diesel::sql_types::{Nullable, Integer, Array};
283    /// #     let connection = &mut establish_connection();
284    /// let int =
285    ///     diesel::select(lower_inf::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;
286    /// assert_eq!(false, int);
287    ///
288    /// let int = diesel::select(lower_inf::<Range<Integer>, _>(..5)).get_result::<bool>(connection)?;
289    /// assert_eq!(true, int);
290    ///
291    /// let int = diesel::select(lower_inf::<Nullable<Range<Integer>>, _>(
292    ///     None::<std::ops::Range<i32>>,
293    /// ))
294    /// .get_result::<Option<bool>>(connection)?;
295    /// assert_eq!(None, int);
296    ///
297    /// let int = diesel::select(lower_inf::<Multirange<Integer>, _>(vec![5..7]))
298    ///     .get_result::<bool>(connection)?;
299    /// assert_eq!(false, int);
300    /// #     Ok(())
301    /// # }
302    /// ```
303    #[cfg(feature = "postgres_backend")]
304    fn lower_inf<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>>(
305        range: R,
306    ) -> R::Out;
307
308    /// Returns true if the range's upper bound is unbounded
309    ///
310    /// # Example
311    ///
312    /// ```rust
313    /// # include!("../../doctest_setup.rs");
314    /// #
315    /// # fn main() {
316    /// #     run_test().unwrap();
317    /// # }
318    /// #
319    /// # fn run_test() -> QueryResult<()> {
320    /// # use diesel::pg::sql_types::{Range, Multirange};
321    /// # use diesel::dsl::upper_inf;
322    /// #     use std::collections::Bound;
323    /// #     use diesel::sql_types::{Nullable, Integer, Array};
324    /// #     let connection = &mut establish_connection();
325    /// let int =
326    ///     diesel::select(upper_inf::<Range<Integer>, _>(1..5)).get_result::<bool>(connection)?;
327    /// assert_eq!(false, int);
328    ///
329    /// let int = diesel::select(upper_inf::<Range<Integer>, _>(1..)).get_result::<bool>(connection)?;
330    /// assert_eq!(true, int);
331    ///
332    /// let int = diesel::select(upper_inf::<Nullable<Range<Integer>>, _>(
333    ///     None::<std::ops::Range<i32>>,
334    /// ))
335    /// .get_result::<Option<bool>>(connection)?;
336    /// assert_eq!(None, int);
337    ///
338    /// let int = diesel::select(upper_inf::<Multirange<Integer>, _>(vec![5..7]))
339    ///     .get_result::<bool>(connection)?;
340    /// assert_eq!(false, int);
341    /// #     Ok(())
342    /// # }
343    /// ```
344    #[cfg(feature = "postgres_backend")]
345    fn upper_inf<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>>(
346        range: R,
347    ) -> R::Out;
348
349    /// Returns the smallest range which includes both of the given ranges
350    ///
351    /// # Example
352    ///
353    /// ```rust
354    /// # include!("../../doctest_setup.rs");
355    /// #
356    /// # fn main() {
357    /// #     run_test().unwrap();
358    /// # }
359    /// #
360    /// # fn run_test() -> QueryResult<()> {
361    /// # use diesel::pg::sql_types::{Range, Multirange};
362    /// # use diesel::dsl::range_merge;
363    /// #     use std::collections::Bound;
364    /// #     use diesel::sql_types::{Nullable, Integer, Array};
365    /// #     let connection = &mut establish_connection();
366    /// let int = diesel::select(range_merge::<Range<Integer>, Range<_>, _, _>(5..11, 10..))
367    ///     .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;
368    /// assert_eq!((Bound::Included(5), Bound::Unbounded), int);
369    ///
370    /// let int = diesel::select(range_merge::<Range<Integer>, Range<_>, _, _>(1..3, 7..10))
371    ///     .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;
372    /// assert_eq!((Bound::Included(1), Bound::Excluded(10)), int);
373    ///
374    /// let int = diesel::select(range_merge::<
375    ///     Nullable<Range<Integer>>,
376    ///     Nullable<Range<_>>,
377    ///     _,
378    ///     _,
379    /// >(None::<std::ops::Range<i32>>, 7..10))
380    /// .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;
381    /// assert_eq!(None, int);
382    ///
383    /// let int = diesel::select(range_merge::<
384    ///     Nullable<Range<Integer>>,
385    ///     Nullable<Range<_>>,
386    ///     _,
387    ///     _,
388    /// >(1..3, None::<std::ops::Range<i32>>))
389    /// .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;
390    /// assert_eq!(None, int);
391    /// #     Ok(())
392    /// # }
393    /// ```
394    #[cfg(feature = "postgres_backend")]
395    fn range_merge<
396        R1: RangeOrNullableRange + SingleValue,
397        R2: RangeOrNullableRange<Inner = R1::Inner>
398            + SingleValue
399            + CombinedNullableValue<R1, Range<R1::Inner>>,
400    >(
401        lhs: R1,
402        rhs: R2,
403    ) -> R2::Out;
404
405    /// Returns the smallest range which includes all ranges in the multirange
406    ///
407    /// # Example
408    ///
409    /// ```rust
410    /// # include!("../../doctest_setup.rs");
411    /// #
412    /// # fn main() {
413    /// #     run_test().unwrap();
414    /// # }
415    /// #
416    /// # fn run_test() -> QueryResult<()> {
417    /// # use diesel::pg::sql_types::{Range, Multirange};
418    /// # use diesel::dsl::multirange_merge;
419    /// #     use std::collections::Bound;
420    /// #     use diesel::sql_types::{Nullable, Integer, Array};
421    /// #     let connection = &mut establish_connection();
422    /// let int = diesel::select(multirange_merge::<Multirange<Integer>, _>(vec![
423    ///     1..3,
424    ///     7..10,
425    /// ]))
426    /// .get_result::<(Bound<i32>, Bound<i32>)>(connection)?;
427    /// assert_eq!((Bound::Included(1), Bound::Excluded(10)), int);
428    ///
429    /// let int = diesel::select(multirange_merge::<Nullable<Multirange<Integer>>, _>(
430    ///     None::<Vec<std::ops::Range<i32>>>,
431    /// ))
432    /// .get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;
433    /// assert_eq!(None, int);
434    /// #     Ok(())
435    /// # }
436    /// ```
437    #[cfg(feature = "postgres_backend")]
438    #[sql_name = "range_merge"]
439    fn multirange_merge<R: MultirangeOrNullableMultirange + SingleValue>(multirange: R)
440    -> R::Range;
441
442    /// Returns range of integer
443    ///
444    /// # Example
445    ///
446    /// ```rust
447    /// # include!("../../doctest_setup.rs");
448    /// #
449    /// # table! {
450    /// #     posts {
451    /// #         id -> Integer,
452    /// #         versions -> Int4range,
453    /// #     }
454    /// # }
455    /// #
456    /// # fn main() {
457    /// #     run_test().unwrap();
458    /// # }
459    /// #
460    /// # fn run_test() -> QueryResult<()> {
461    /// #     use self::posts::dsl::*;
462    /// #     use std::collections::Bound;
463    /// #     let conn = &mut establish_connection();
464    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
465    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions INT4RANGE NOT NULL)").execute(conn).unwrap();
466    /// #
467    /// use diesel::dsl::int4range;
468    /// use diesel::pg::sql_types::RangeBound;
469    ///
470    /// diesel::insert_into(posts)
471    ///     .values(&[
472    ///        versions.eq(int4range(Some(3), Some(5), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
473    ///        versions.eq(int4range(None, Some(2), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
474    ///     ]).execute(conn)?;
475    ///
476    /// let cool_posts = posts.select(versions)
477    ///     .load::<(Bound<i32>, Bound<i32>)>(conn)?;
478    /// assert_eq!(vec![
479    ///          (Bound::Included(3), Bound::Excluded(6)), // Postgres cast this internally
480    ///          (Bound::Unbounded, Bound::Excluded(2)),
481    ///      ], cool_posts);
482    /// #     Ok(())
483    /// # }
484    /// ```
485    #[cfg(feature = "postgres_backend")]
486    fn int4range(
487        lower: Nullable<Integer>,
488        upper: Nullable<Integer>,
489        bound: RangeBoundEnum,
490    ) -> Int4range;
491
492    /// Returns range of big ints
493    ///
494    /// # Example
495    ///
496    /// ```rust
497    /// # include!("../../doctest_setup.rs");
498    /// #
499    /// # table! {
500    /// #     posts {
501    /// #         id -> Integer,
502    /// #         versions -> Int8range,
503    /// #     }
504    /// # }
505    /// #
506    /// # fn main() {
507    /// #     run_test().unwrap();
508    /// # }
509    /// #
510    /// # fn run_test() -> QueryResult<()> {
511    /// #     use self::posts::dsl::*;
512    /// #     use std::collections::Bound;
513    /// #     let conn = &mut establish_connection();
514    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
515    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions INT8RANGE NOT NULL)").execute(conn).unwrap();
516    /// #
517    /// use diesel::dsl::int8range;
518    /// use diesel::pg::sql_types::RangeBound;
519    ///
520    /// diesel::insert_into(posts)
521    ///     .values(&[
522    ///        versions.eq(int8range(Some(3), Some(5), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
523    ///        versions.eq(int8range(None, Some(2), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
524    ///     ]).execute(conn)?;
525    ///
526    /// let cool_posts = posts.select(versions)
527    ///     .load::<(Bound<i64>, Bound<i64>)>(conn)?;
528    /// assert_eq!(vec![
529    ///          (Bound::Included(3), Bound::Excluded(6)), // Postgres cast this internally
530    ///          (Bound::Unbounded, Bound::Excluded(2)),
531    ///      ], cool_posts);
532    /// #     Ok(())
533    /// # }
534    /// ```
535    #[cfg(feature = "postgres_backend")]
536    fn int8range(
537        lower: Nullable<BigInt>,
538        upper: Nullable<BigInt>,
539        bound: RangeBoundEnum,
540    ) -> Int8range;
541
542    /// Returns range of numeric values
543    ///
544    /// # Example
545    ///
546    /// ```rust
547    /// # include!("../../doctest_setup.rs");
548    /// #
549    /// # table! {
550    /// #     posts {
551    /// #         id -> Integer,
552    /// #         versions -> Numrange,
553    /// #     }
554    /// # }
555    /// #
556    /// # fn main() {
557    /// #     #[cfg(feature = "numeric")]
558    /// #     run_test().unwrap();
559    /// # }
560    /// #
561    /// # #[cfg(feature = "numeric")]
562    /// # fn run_test() -> QueryResult<()> {
563    /// #     use self::posts::dsl::*;
564    /// #     use std::collections::Bound;
565    /// #     let conn = &mut establish_connection();
566    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
567    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions NUMRANGE NOT NULL)").execute(conn).unwrap();
568    /// #
569    /// # use bigdecimal::BigDecimal;
570    /// use diesel::dsl::numrange;
571    /// use diesel::pg::sql_types::RangeBound;
572    ///
573    /// diesel::insert_into(posts)
574    ///     .values(&[
575    ///        versions.eq(numrange(Some(BigDecimal::from(3)), Some(BigDecimal::from(5)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
576    ///        versions.eq(numrange(None, Some(BigDecimal::from(2)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
577    ///     ]).execute(conn)?;
578    ///
579    /// let cool_posts = posts.select(versions)
580    ///     .load::<(Bound<BigDecimal>, Bound<BigDecimal>)>(conn)?;
581    /// assert_eq!(vec![
582    ///          (Bound::Included(BigDecimal::from(3)), Bound::Included(BigDecimal::from(5))),
583    ///          (Bound::Unbounded, Bound::Excluded(BigDecimal::from(2))),
584    ///      ], cool_posts);
585    /// #     Ok(())
586    /// # }
587    /// ```
588    #[cfg(feature = "postgres_backend")]
589    fn numrange(
590        lower: Nullable<Numeric>,
591        upper: Nullable<Numeric>,
592        bound: RangeBoundEnum,
593    ) -> Numrange;
594
595    /// Returns range of timestamps without timezone
596    ///
597    /// # Example
598    ///
599    /// ```rust
600    /// # include!("../../doctest_setup.rs");
601    /// #
602    /// # table! {
603    /// #     posts {
604    /// #         id -> Integer,
605    /// #         versions -> Tsrange,
606    /// #     }
607    /// # }
608    /// #
609    /// # fn main() {
610    /// #     #[cfg(feature = "time")]
611    /// #     run_test().unwrap();
612    /// # }
613    /// #
614    /// # #[cfg(feature = "time")]
615    /// # fn run_test() -> QueryResult<()> {
616    /// #     use self::posts::dsl::*;
617    /// #     use std::collections::Bound;
618    /// #     let conn = &mut establish_connection();
619    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
620    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions TSRANGE NOT NULL)").execute(conn).unwrap();
621    /// #
622    /// use diesel::dsl::tsrange;
623    /// use diesel::pg::sql_types::RangeBound;
624    /// use time::{PrimitiveDateTime, macros::datetime};
625    ///
626    /// diesel::insert_into(posts)
627    ///     .values(&[
628    ///        versions.eq(tsrange(Some(datetime!(2020-01-01 0:00)), Some(datetime!(2021-01-01 0:00)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
629    ///        versions.eq(tsrange(None, Some(datetime!(2020-01-01 0:00)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
630    ///     ]).execute(conn)?;
631    ///
632    /// let cool_posts = posts.select(versions)
633    ///     .load::<(Bound<PrimitiveDateTime>, Bound<PrimitiveDateTime>)>(conn)?;
634    /// assert_eq!(vec![
635    ///          (Bound::Included(datetime!(2020-01-01 0:00)), Bound::Included(datetime!(2021-01-01 0:00))),
636    ///          (Bound::Unbounded, Bound::Excluded(datetime!(2020-01-01 0:00))),
637    ///      ], cool_posts);
638    /// #     Ok(())
639    /// # }
640    /// ```
641    #[cfg(feature = "postgres_backend")]
642    fn tsrange(
643        lower: Nullable<Timestamp>,
644        upper: Nullable<Timestamp>,
645        bound: RangeBoundEnum,
646    ) -> Tsrange;
647
648    /// Returns range of timestamps with timezone
649    ///
650    /// # Example
651    ///
652    /// ```rust
653    /// # include!("../../doctest_setup.rs");
654    /// #
655    /// # table! {
656    /// #     posts {
657    /// #         id -> Integer,
658    /// #         versions -> Tstzrange,
659    /// #     }
660    /// # }
661    /// #
662    /// # fn main() {
663    /// #     #[cfg(feature = "time")]
664    /// #     run_test().unwrap();
665    /// # }
666    /// #
667    /// # #[cfg(feature = "time")]
668    /// # fn run_test() -> QueryResult<()> {
669    /// #     use self::posts::dsl::*;
670    /// #     use std::collections::Bound;
671    /// #     let conn = &mut establish_connection();
672    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
673    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions TSTZRANGE NOT NULL)").execute(conn).unwrap();
674    /// #
675    /// use diesel::dsl::tstzrange;
676    /// use diesel::pg::sql_types::RangeBound;
677    /// use time::{OffsetDateTime, macros::datetime};
678    ///
679    /// diesel::insert_into(posts)
680    ///     .values(&[
681    ///        versions.eq(tstzrange(Some(datetime!(2020-01-01 0:00 UTC)), Some(datetime!(2021-01-01 0:00 -3)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
682    ///        versions.eq(tstzrange(None, Some(datetime!(2020-01-01 0:00 +2)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
683    ///     ]).execute(conn)?;
684    ///
685    /// let cool_posts = posts.select(versions)
686    ///     .load::<(Bound<OffsetDateTime>, Bound<OffsetDateTime>)>(conn)?;
687    /// assert_eq!(vec![
688    ///          (Bound::Included(datetime!(2020-01-01 0:00 UTC)), Bound::Included(datetime!(2021-01-01 0:00 -3))),
689    ///          (Bound::Unbounded, Bound::Excluded(datetime!(2020-01-01 0:00 +2))),
690    ///      ], cool_posts);
691    /// #     Ok(())
692    /// # }
693    /// ```
694    #[cfg(feature = "postgres_backend")]
695    fn tstzrange(
696        lower: Nullable<Timestamptz>,
697        upper: Nullable<Timestamptz>,
698        bound: RangeBoundEnum,
699    ) -> Tstzrange;
700
701    /// Returns range of dates
702    ///
703    /// # Example
704    ///
705    /// ```rust
706    /// # include!("../../doctest_setup.rs");
707    /// #
708    /// # table! {
709    /// #     posts {
710    /// #         id -> Integer,
711    /// #         versions -> Daterange,
712    /// #     }
713    /// # }
714    /// #
715    /// # fn main() {
716    /// #     #[cfg(feature = "time")]
717    /// #     run_test().unwrap();
718    /// # }
719    /// #
720    /// # #[cfg(feature = "time")]
721    /// # fn run_test() -> QueryResult<()> {
722    /// #     use self::posts::dsl::*;
723    /// #     use std::collections::Bound;
724    /// #     let conn = &mut establish_connection();
725    /// #     diesel::sql_query("DROP TABLE IF EXISTS posts").execute(conn).unwrap();
726    /// #     diesel::sql_query("CREATE TABLE posts (id SERIAL PRIMARY KEY, versions DATERANGE NOT NULL)").execute(conn).unwrap();
727    /// #
728    /// use diesel::dsl::daterange;
729    /// use diesel::pg::sql_types::RangeBound;
730    /// use time::{Date, macros::date};
731    ///
732    /// diesel::insert_into(posts)
733    ///     .values(&[
734    ///        versions.eq(daterange(Some(date!(2020-01-01)), Some(date!(2021-01-01)), RangeBound::LowerBoundInclusiveUpperBoundInclusive)),
735    ///        versions.eq(daterange(None, Some(date!(2020-01-01)), RangeBound::LowerBoundInclusiveUpperBoundExclusive)),
736    ///     ]).execute(conn)?;
737    ///
738    /// let cool_posts = posts.select(versions)
739    ///     .load::<(Bound<Date>, Bound<Date>)>(conn)?;
740    /// assert_eq!(vec![
741    ///          (Bound::Included(date!(2020-01-01)), Bound::Excluded(date!(2021-01-02))),
742    ///          (Bound::Unbounded, Bound::Excluded(date!(2020-01-01))),
743    ///      ], cool_posts);
744    /// #     Ok(())
745    /// # }
746    /// ```
747    #[cfg(feature = "postgres_backend")]
748    fn daterange(lower: Nullable<Date>, upper: Nullable<Date>, bound: RangeBoundEnum) -> Daterange;
749
750    /// Append an element to the end of an array
751    ///
752    /// # Example
753    ///
754    /// ```rust
755    /// # include!("../../doctest_setup.rs");
756    /// #
757    /// # fn main() {
758    /// #     run_test().unwrap();
759    /// # }
760    /// #
761    /// # fn run_test() -> QueryResult<()> {
762    /// #     use diesel::dsl::array_append;
763    /// #     use diesel::sql_types::{Nullable, Integer, Array};
764    /// #     let connection = &mut establish_connection();
765    /// let ints = diesel::select(array_append::<Array<_>, Integer, _, _>(vec![1, 2], 3))
766    ///     .get_result::<Vec<i32>>(connection)?;
767    /// assert_eq!(vec![1, 2, 3], ints);
768    ///
769    /// let ints = diesel::select(array_append::<Array<_>, Nullable<Integer>, _, _>(
770    ///     vec![Some(1), Some(2)],
771    ///     None::<i32>,
772    /// ))
773    /// .get_result::<Vec<Option<i32>>>(connection)?;
774    /// assert_eq!(vec![Some(1), Some(2), None], ints);
775    ///
776    /// let ints = diesel::select(array_append::<Nullable<Array<_>>, Integer, _, _>(
777    ///     None::<Vec<i32>>,
778    ///     3,
779    /// ))
780    /// .get_result::<Vec<i32>>(connection)?;
781    /// assert_eq!(vec![3], ints);
782    ///
783    /// let ints = diesel::select(array_append::<Nullable<Array<_>>, Nullable<Integer>, _, _>(
784    ///     None::<Vec<i32>>,
785    ///     None::<i32>,
786    /// ))
787    /// .get_result::<Vec<Option<i32>>>(connection)?;
788    /// assert_eq!(vec![None], ints);
789    /// #     Ok(())
790    /// # }
791    /// ```
792    #[cfg(feature = "postgres_backend")]
793    fn array_append<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue>(
794        a: Arr,
795        e: T,
796    ) -> Array<T>;
797
798    /// Replace all occurrences of an element in an array with a given element
799    ///
800    /// # Example
801    ///
802    /// ```rust
803    /// # include!("../../doctest_setup.rs");
804    /// #
805    /// # fn main() {
806    /// #     run_test().unwrap();
807    /// # }
808    /// #
809    /// # fn run_test() -> QueryResult<()> {
810    /// #     use diesel::dsl::array_replace;
811    /// #     use diesel::sql_types::{Nullable, Integer, Array};
812    /// #     let connection = &mut establish_connection();
813    /// let ints = diesel::select(array_replace::<Array<_>, Integer, _, _, _>(
814    ///     vec![1, 2, 5, 4],
815    ///     5,
816    ///     3,
817    /// ))
818    /// .get_result::<Vec<i32>>(connection)?;
819    /// assert_eq!(vec![1, 2, 3, 4], ints);
820    ///
821    /// let ints = diesel::select(array_replace::<Array<_>, Nullable<Integer>, _, _, _>(
822    ///     vec![Some(1), Some(2), Some(3)],
823    ///     Some(3),
824    ///     None::<i32>,
825    /// ))
826    /// .get_result::<Vec<Option<i32>>>(connection)?;
827    /// assert_eq!(vec![Some(1), Some(2), None], ints);
828    ///
829    /// let ints = diesel::select(array_replace::<Nullable<Array<_>>, Integer, _, _, _>(
830    ///     None::<Vec<i32>>,
831    ///     1,
832    ///     2,
833    /// ))
834    /// .get_result::<Option<Vec<i32>>>(connection)?;
835    ///
836    /// let ints = diesel::select(array_replace::<
837    ///     Nullable<Array<_>>,
838    ///     Nullable<Integer>,
839    ///     _,
840    ///     _,
841    ///     _,
842    /// >(None::<Vec<i32>>, None::<i32>, Some(1)))
843    /// .get_result::<Option<Vec<Option<i32>>>>(connection)?;
844    /// assert_eq!(None, ints);
845    /// #    Ok(())
846    /// # }
847    /// ```
848    #[cfg(feature = "postgres_backend")]
849    fn array_replace<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue>(
850        a: Arr,
851        e: T,
852        r: T,
853    ) -> Arr;
854
855    /// Returns a text representation of the array's dimensions
856    ///
857    /// # Example
858    ///
859    /// ```rust
860    /// # include!("../../doctest_setup.rs");
861    /// #
862    /// # fn main(){
863    /// #    run_test().unwrap();
864    /// # }
865    /// # fn run_test()->QueryResult<()>{
866    /// #   use diesel::dsl::array_dims;
867    /// #   use diesel::sql_types::{Nullable,Array,Integer};
868    /// #   let connection = &mut establish_connection();
869    ///
870    /// let dims = diesel::select(array_dims::<Array<Integer>,_>(vec![1,2]))
871    ///     .get_result::<String>(connection)?;
872    /// assert!(String::from("[1:2]").eq(&dims));
873    ///
874    /// let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>,Some(2)]))
875    ///     .get_result::<String>(connection)?;
876    /// assert!(String::from("[1:2]").eq(&dims));
877    ///
878    /// let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>]))
879    ///     .get_result::<String>(connection)?;
880    /// assert!(String::from("[1:1]").eq(&dims));
881    /// # Ok(())
882    /// # }
883    #[cfg(feature = "postgres_backend")]
884    fn array_dims<Arr: ArrayOrNullableArray + SingleValue>(arr: Arr) -> Text;
885
886    /// Prepends an element to the beginning of an array
887    ///
888    /// # Example
889    ///
890    /// ```rust
891    /// # include!("../../doctest_setup.rs");
892    /// #
893    /// # fn main() {
894    /// #     run_test().unwrap();
895    /// # }
896    /// #
897    /// # fn run_test() -> QueryResult<()> {
898    /// #     use diesel::dsl::array_prepend;
899    /// #     use diesel::sql_types::{Nullable, Integer, Array};
900    /// #     let connection = &mut establish_connection();
901    /// let ints = diesel::select(array_prepend::<Integer, Array<_>, _, _>(3, vec![1, 2]))
902    ///     .get_result::<Vec<i32>>(connection)?;
903    /// assert_eq!(vec![3, 1, 2], ints);
904    ///
905    /// let ints = diesel::select(array_prepend::<Nullable<Integer>, Array<_>, _, _>(
906    ///     None::<i32>,
907    ///     vec![Some(1), Some(2)],
908    /// ))
909    /// .get_result::<Vec<Option<i32>>>(connection)?;
910    /// assert_eq!(vec![None, Some(1), Some(2)], ints);
911    ///
912    /// let ints = diesel::select(array_prepend::<Integer, Nullable<Array<_>>, _, _>(
913    ///     3,
914    ///     None::<Vec<i32>>,
915    /// ))
916    /// .get_result::<Vec<i32>>(connection)?;
917    /// assert_eq!(vec![3], ints);
918    ///
919    /// let ints = diesel::select(
920    ///     array_prepend::<Nullable<Integer>, Nullable<Array<_>>, _, _>(None::<i32>, None::<Vec<i32>>),
921    /// )
922    /// .get_result::<Vec<Option<i32>>>(connection)?;
923    /// assert_eq!(vec![None], ints);
924    /// #     Ok(())
925    /// # }
926    /// ```
927    #[cfg(feature = "postgres_backend")]
928    fn array_prepend<T: SingleValue, Arr: ArrayOrNullableArray<Inner = T> + SingleValue>(
929        e: T,
930        a: Arr,
931    ) -> Array<T>;
932
933    /// Removes all elements equal to the given value from the array
934    ///
935    /// # Example
936    ///
937    /// ```rust
938    /// # include!("../../doctest_setup.rs");
939    /// #
940    /// # fn main() {
941    /// #     run_test().unwrap();
942    /// # }
943    /// #
944    /// # fn run_test() -> QueryResult<()> {
945    /// #     use diesel::dsl::array_remove;
946    /// #     use diesel::sql_types::{Nullable, Integer, Array};
947    /// #     let connection = &mut establish_connection();
948    /// let ints = diesel::select(array_remove::<Array<_>, Integer, _, _>(vec![1, 2, 3, 2], 2))
949    ///     .get_result::<Vec<i32>>(connection)?;
950    /// assert_eq!(vec![1, 3], ints);
951    ///
952    /// let ints = diesel::select(array_remove::<Array<_>, Nullable<Integer>, _, _>(
953    ///     vec![None, Some(1), Some(2), None, Some(4)],
954    ///     None::<i32>,
955    /// ))
956    /// .get_result::<Vec<Option<i32>>>(connection)?;
957    /// assert_eq!(vec![Some(1), Some(2), Some(4)], ints);
958    ///
959    /// let ints = diesel::select(array_remove::<Nullable<Array<_>>, Nullable<Integer>, _, _>(
960    ///     None::<Vec<i32>>,
961    ///     None::<i32>,
962    /// ))
963    /// .get_result::<Option<Vec<Option<i32>>>>(connection)?;
964    /// assert_eq!(None, ints);
965    /// #     Ok(())
966    /// # }
967    /// ```
968    #[cfg(feature = "postgres_backend")]
969    fn array_remove<Arr: ArrayOrNullableArray<Inner = T> + SingleValue, T: SingleValue>(
970        a: Arr,
971        e: T,
972    ) -> Arr;
973
974    /// Converts each array element to its text representation and concatenates those elements
975    /// separated by the delimiter string. If `null_string` is provided and is not `NULL`, then `NULL`
976    /// array entries are represented by that string; otherwise, they are omitted.
977    ///
978    /// # Example
979    ///
980    /// ```rust
981    /// # include!("../../doctest_setup.rs");
982    /// #
983    /// # fn main() {
984    /// #     run_test().unwrap();
985    /// # }
986    /// #
987    /// # fn run_test() -> QueryResult<()> {
988    /// #     use diesel::dsl::array_to_string_with_null_string;
989    /// #     use diesel::sql_types::{Nullable, Text, Array};
990    /// #     let connection = &mut establish_connection();
991    ///
992    /// // Example with `NULL` representation as a string
993    /// let result: String = diesel::select(array_to_string_with_null_string::<
994    ///     Array<Nullable<Text>>,
995    ///     _,
996    ///     _,
997    ///     _,
998    /// >(
999    ///     vec![Some("first"), None::<&str>, Some("third")],
1000    ///     ",",
1001    ///     "NULL",
1002    /// ))
1003    /// .get_result(connection)?;
1004    /// assert_eq!(result, "first,NULL,third");
1005    ///
1006    /// // Example without any `NULL` values
1007    /// let result: String = diesel::select(array_to_string_with_null_string::<
1008    ///     Array<Nullable<Text>>,
1009    ///     _,
1010    ///     _,
1011    ///     _,
1012    /// >(vec![Some("first"), Some("second")], ",", "NULL"))
1013    /// .get_result(connection)?;
1014    /// assert_eq!(result, "first,second");
1015    ///
1016    /// // Example with all `NULL` values
1017    /// let result: String = diesel::select(array_to_string_with_null_string::<
1018    ///     Array<Nullable<Text>>,
1019    ///     _,
1020    ///     _,
1021    ///     _,
1022    /// >(vec![None::<&str>, None::<&str>], ",", "NULL"))
1023    /// .get_result(connection)?;
1024    /// assert_eq!(result, "NULL,NULL");
1025    ///
1026    /// #     Ok(())
1027    /// # }
1028    /// ```
1029    #[cfg(feature = "postgres_backend")]
1030    #[sql_name = "array_to_string"]
1031    fn array_to_string_with_null_string<Arr: ArrayOrNullableArray + SingleValue>(
1032        array: Arr,
1033        del: Text,
1034        null: Text,
1035    ) -> Text;
1036
1037    /// Converts each array element to its text representation and concatenates those elements
1038    /// separated by the delimiter string. `NULL` entries are omitted in this variant.
1039    /// See [array_to_string_with_null_string](array_to_string_with_null_string()) for a variant with that argument.
1040    ///
1041    /// # Example
1042    ///
1043    /// ```rust
1044    /// # include!("../../doctest_setup.rs");
1045    /// #
1046    /// # fn main() {
1047    /// #     run_test().unwrap();
1048    /// # }
1049    /// #
1050    /// # fn run_test() -> QueryResult<()> {
1051    /// #     use diesel::dsl::array_to_string;
1052    /// #     use diesel::sql_types::{Text, Array, Nullable};
1053    /// #     let connection = &mut establish_connection();
1054    ///
1055    /// // Example with non-null values
1056    /// let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>(
1057    ///     vec![Some("first"), Some("second")],
1058    ///     ",",
1059    /// ))
1060    /// .get_result(connection)?;
1061    /// assert_eq!(result, "first,second");
1062    ///
1063    /// // Example with `NULL` values (omitted in the result)
1064    /// let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>(
1065    ///     vec![Some("first"), None::<&str>, Some("third")],
1066    ///     ",",
1067    /// ))
1068    /// .get_result(connection)?;
1069    /// assert_eq!(result, "first,third");
1070    ///
1071    /// // Example with only `NULL` values (empty result)
1072    /// let result: String = diesel::select(array_to_string::<Array<Nullable<Text>>, _, _>(
1073    ///     vec![None::<&str>, None::<&str>],
1074    ///     ",",
1075    /// ))
1076    /// .get_result(connection)?;
1077    /// assert_eq!(result, "");
1078    ///
1079    /// #     Ok(())
1080    /// # }
1081    /// ```
1082    #[cfg(feature = "postgres_backend")]
1083    fn array_to_string<Arr: ArrayOrNullableArray + SingleValue>(array: Arr, del: Text) -> Text;
1084
1085    /// Returns the total number of elements in the array, or 0 if the array is empty.
1086    ///
1087    /// # Example
1088    ///
1089    /// ```rust
1090    /// # include!("../../doctest_setup.rs");
1091    /// #
1092    /// # fn main(){
1093    /// #    run_test().unwrap();
1094    /// # }
1095    /// # fn run_test()->QueryResult<()>{
1096    /// #   use diesel::dsl::cardinality;
1097    /// #   use diesel::sql_types::{Nullable,Array,Integer};
1098    /// #   let connection = &mut establish_connection();
1099    ///
1100    /// let array_cardinality = diesel::select(cardinality::<Array<Integer>, _>(vec![1, 2, 3, 4]))
1101    ///     .get_result::<i32>(connection)?;
1102    /// assert_eq!(4, array_cardinality);
1103    ///
1104    /// let array_cardinality = diesel::select(cardinality::<Array<Nullable<Integer>>, _>(vec![Some(1), Some(2), Some(3)]))
1105    ///     .get_result::<i32>(connection)?;
1106    /// assert_eq!(3, array_cardinality);
1107    ///
1108    /// let array_cardinality = diesel::select(cardinality::<Array<Integer>, _>(Vec::<i32>::new()))
1109    ///     .get_result::<i32>(connection)?;
1110    /// assert_eq!(0, array_cardinality);
1111    ///
1112    /// let array_cardinality = diesel::select(cardinality::<Nullable<Array<Integer>>, _>(None::<Vec<i32>>))
1113    ///     .get_result::<Option<i32>>(connection)?;
1114    /// assert_eq!(None, array_cardinality);
1115    /// # Ok(())
1116    /// # }
1117    #[cfg(feature = "postgres_backend")]
1118    fn cardinality<Arr: ArrayOrNullableArray + SingleValue + MaybeNullableValue<Integer>>(
1119        a: Arr,
1120    ) -> Arr::Out;
1121
1122    /// Trims an array by removing the last n elements. If the array is multidimensional, only the first dimension is trimmed.
1123    ///
1124    /// # Example
1125    ///
1126    /// ```rust
1127    /// # include!("../../doctest_setup.rs");
1128    /// #
1129    /// # fn main(){
1130    /// #    run_test().unwrap();
1131    /// # }
1132    /// # fn run_test()->QueryResult<()>{
1133    /// #   use diesel::dsl::trim_array;
1134    /// #   use diesel::sql_types::{Nullable,Array,Integer};
1135    /// #   let connection = &mut establish_connection();
1136    ///
1137    /// let trimmed_array = diesel::select(trim_array::<Array<Integer>, _, _>(vec![1, 2, 3, 4], 3))
1138    ///     .get_result::<Vec<i32>>(connection)?;
1139    /// assert_eq!(vec![1], trimmed_array);
1140    ///
1141    /// let trimmed_array = diesel::select(trim_array::<Array<Nullable<Integer>>, _, _>(vec![Some(1), Some(2), Some(3)], 1))
1142    ///     .get_result::<Vec<Option<i32>>>(connection)?;
1143    /// assert_eq!(vec![Some(1), Some(2)], trimmed_array);
1144    ///
1145    /// let trimmed_array = diesel::select(trim_array::<Array<Integer>, _, _>(Vec::<i32>::new(), 0))
1146    ///     .get_result::<Vec<i32>>(connection)?;
1147    /// assert_eq!(Vec::<i32>::new(), trimmed_array);
1148    ///
1149    /// let trimmed_array = diesel::select(trim_array::<Nullable<Array<Integer>>, _, _>(None::<Vec<i32>>, 0))
1150    ///     .get_result::<Option<Vec<i32>>>(connection)?;
1151    /// assert_eq!(None, trimmed_array);
1152    ///
1153    /// let trimmed_array = diesel::select(trim_array::<Nullable<Array<Integer>>, _, _>(None::<Vec<i32>>, 1))
1154    ///     .get_result::<Option<Vec<i32>>>(connection)?;
1155    /// assert_eq!(None, trimmed_array);
1156    /// # Ok(())
1157    /// # }
1158    #[cfg(feature = "postgres_backend")]
1159    fn trim_array<Arr: ArrayOrNullableArray + SingleValue>(a: Arr, n: Integer) -> Arr;
1160
1161    /// Concatenates two arrays
1162    ///
1163    /// # Example
1164    ///
1165    /// ```rust
1166    /// # include!("../../doctest_setup.rs");
1167    /// #
1168    /// # fn main() {
1169    /// #     run_test().unwrap();
1170    /// # }
1171    /// #
1172    /// # fn run_test() -> QueryResult<()> {
1173    /// #     use diesel::dsl::array_cat;
1174    /// #     use diesel::sql_types::{Integer, Array, Nullable};
1175    /// #     let connection = &mut establish_connection();
1176    /// let result = diesel::select(array_cat::<Array<Integer>, _, _>(vec![1, 2], vec![3, 4]))
1177    ///     .get_result::<Vec<i32>>(connection)?;
1178    /// assert_eq!(vec![1, 2, 3, 4], result);
1179    ///
1180    /// let nullable_result = diesel::select(array_cat::<Nullable<Array<Integer>>, _, _>(
1181    ///     None::<Vec<i32>>,
1182    ///     None::<Vec<i32>>,
1183    /// ))
1184    /// .get_result::<Option<Vec<i32>>>(connection)?;
1185    /// assert_eq!(None, nullable_result);
1186    /// #     Ok(())
1187    /// # }
1188    /// ```
1189    #[cfg(feature = "postgres_backend")]
1190    fn array_cat<Arr: ArrayOrNullableArray + SingleValue>(a: Arr, b: Arr) -> Arr;
1191
1192    /// Returns the length of the requested array
1193    ///
1194    /// # Example
1195    ///
1196    /// ```rust
1197    /// # include!("../../doctest_setup.rs");
1198    /// #
1199    /// # fn main() {
1200    /// #     run_test().unwrap();
1201    /// # }
1202    /// #
1203    /// # fn run_test() -> QueryResult<()> {
1204    /// #     use diesel::dsl::array_length;
1205    /// #     use diesel::sql_types::{Integer, Array, Nullable};
1206    /// #     let connection = &mut establish_connection();
1207    /// let result = diesel::select(array_length::<Array<Integer>, _, _>(vec![1, 2, 3], 1))
1208    ///     .get_result::<Option<i32>>(connection)?;
1209    /// assert_eq!(Some(3), result);
1210    ///
1211    /// let result = diesel::select(array_length::<Array<Integer>, _, _>(vec![1, 2, 3], 2))
1212    ///     .get_result::<Option<i32>>(connection)?;
1213    /// assert_eq!(None, result);
1214    ///
1215    /// let result = diesel::select(array_length::<Nullable<Array<Integer>>, _, _>(
1216    ///     None::<Vec<i32>>,
1217    ///     1,
1218    /// ))
1219    /// .get_result::<Option<i32>>(connection)?;
1220    /// assert_eq!(None, result);
1221    /// #     Ok(())
1222    /// # }
1223    /// ```
1224    #[cfg(feature = "postgres_backend")]
1225    fn array_length<Arr: ArrayOrNullableArray + SingleValue>(
1226        array: Arr,
1227        dimension: Integer,
1228    ) -> Nullable<Integer>;
1229
1230    /// Returns an array initialized with supplied value and dimensions,
1231    /// optionally with lower bounds other than 1. This function omits the optional
1232    /// lower bound argument. See [array_fill_with_lower_bound](array_fill_with_lower_bound()) for that.
1233    ///
1234    /// # Example
1235    ///
1236    /// ```rust
1237    /// # include!("../../doctest_setup.rs");
1238    /// #
1239    /// # fn main(){
1240    /// #    run_test().unwrap();
1241    /// # }
1242    /// # fn run_test()->QueryResult<()>{
1243    /// #   use diesel::dsl::array_fill;
1244    /// #   use diesel::sql_types::{Nullable,Array,Integer,Text};
1245    /// #   let connection = &mut establish_connection();
1246    ///
1247    /// let array = diesel::select(array_fill::<Integer,_,_>(2,vec![2]))
1248    /// .get_result::<Vec<i32>>(connection)?;
1249    /// assert_eq!(vec![2,2],array);
1250    ///
1251    /// let array = diesel::select(array_fill::<Text,_,_>(String::from("abc"),vec![3]))
1252    /// .get_result::<Vec<String>>(connection)?;
1253    /// assert_eq!(vec!["abc","abc","abc"],array);
1254    ///
1255    /// let array = diesel::select(array_fill::<Nullable<Integer>,_,_>(Some(4),vec![3]))
1256    /// .get_result::<Vec<Option<i32>>>(connection)?;
1257    /// assert_eq!(vec![Some(4),Some(4),Some(4)],array);
1258    ///
1259    /// let array = diesel::select(array_fill::<Nullable<Integer>,_,_>(None::<i32>,vec![3]))
1260    /// .get_result::<Vec<Option<i32>>>(connection)?;
1261    /// assert_eq!(vec![None::<i32>,None::<i32>,None::<i32>],array);
1262    /// # Ok(())
1263    /// # }
1264    #[cfg(feature = "postgres_backend")]
1265    fn array_fill<E: SingleValue>(value: E, dim: Array<Integer>) -> Array<E>;
1266
1267    /// Returns an array initialized with supplied value and dimensions,
1268    /// with lower bounds other than 1
1269    ///
1270    /// # Example
1271    ///
1272    /// ```rust
1273    /// # include!("../../doctest_setup.rs");
1274    /// #
1275    /// # fn main(){
1276    /// #    run_test().unwrap();
1277    /// # }
1278    /// # fn run_test()->QueryResult<()>{
1279    /// #   use diesel::dsl::array_fill_with_lower_bound;
1280    /// #   use diesel::sql_types::{Nullable,Array,Integer,Text};
1281    /// #   let connection = &mut establish_connection();
1282    ///
1283    /// let array = diesel::select(array_fill_with_lower_bound::<Integer,_,_,_>(2,vec![2],vec![2]))
1284    /// .get_result::<Vec<i32>>(connection)?;
1285    /// assert_eq!(vec![2,2],array);
1286    ///
1287    /// let array = diesel::select(array_fill_with_lower_bound::<Text,_,_,_>(String::from("abc"),vec![3],vec![3]))
1288    /// .get_result::<Vec<String>>(connection)?;
1289    /// assert_eq!(vec!["abc","abc","abc"],array);
1290    ///
1291    /// let array = diesel::select(array_fill_with_lower_bound::<Nullable<Integer>,_,_,_>(Some(4),vec![3],vec![3]))
1292    /// .get_result::<Vec<Option<i32>>>(connection)?;
1293    /// assert_eq!(vec![Some(4),Some(4),Some(4)],array);
1294    ///
1295    /// let array = diesel::select(array_fill_with_lower_bound::<Nullable<Integer>,_,_,_>(None::<i32>,vec![3],vec![3]))
1296    /// .get_result::<Vec<Option<i32>>>(connection)?;
1297    /// assert_eq!(vec![None::<i32>,None::<i32>,None::<i32>],array);
1298    /// # Ok(())
1299    /// # }
1300    #[sql_name = "array_fill"]
1301    #[cfg(feature = "postgres_backend")]
1302    fn array_fill_with_lower_bound<E: SingleValue>(
1303        value: E,
1304        dim: Array<Integer>,
1305        lower_bound: Array<Integer>,
1306    ) -> Array<E>;
1307
1308    /// Returns the lower bound of the requested array
1309    ///
1310    /// This function returns null for dimensions that do not exist
1311    ///
1312    /// # Example
1313    ///
1314    /// ```rust
1315    /// # include!("../../doctest_setup.rs");
1316    /// #
1317    /// # fn main() {
1318    /// #     run_test().unwrap();
1319    /// # }
1320    /// #
1321    /// # fn run_test() -> QueryResult<()> {
1322    /// #     use diesel::dsl::array_lower;
1323    /// #     use diesel::sql_types::{Integer, Array};
1324    /// #     let connection = &mut establish_connection();
1325    /// let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 1))
1326    ///     .get_result::<Option<i32>>(connection)?;
1327    /// assert_eq!(Some(1), result);
1328    ///
1329    /// // the array has only one dimension
1330    /// let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 2))
1331    ///     .get_result::<Option<i32>>(connection)?;
1332    /// assert_eq!(None, result);
1333    /// #     Ok(())
1334    /// # }
1335    /// ```
1336    #[cfg(feature = "postgres_backend")]
1337    fn array_lower<Arr: ArrayOrNullableArray + SingleValue>(
1338        array: Arr,
1339        dimension: Integer,
1340    ) -> Nullable<Integer>;
1341
1342    /// Returns the subscript of the first occurrence of the second argument in the array, or NULL if it's not present.
1343    /// If the third argument is given, the search begins at that subscript. This function omits the third argument.
1344    /// See [array_position_with_subscript](array_position_with_subscript()).
1345    ///
1346    /// The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics,
1347    /// so it is possible to search for NULL.
1348    ///
1349    /// # Example
1350    ///
1351    /// ```rust
1352    /// # include!("../../doctest_setup.rs");
1353    /// #
1354    /// # fn main(){
1355    /// #    run_test().unwrap();
1356    /// # }
1357    /// # fn run_test()->QueryResult<()>{
1358    /// #   use diesel::dsl::array_position;
1359    /// #   use diesel::sql_types::{Nullable,Array,Integer};
1360    /// #   let connection = &mut establish_connection();
1361    ///
1362    /// let pos = diesel::select(array_position::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 3))
1363    ///     .get_result::<Option<i32>>(connection)?;
1364    /// assert_eq!(Some(3), pos);
1365    ///
1366    /// let pos = diesel::select(array_position::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 5))
1367    ///     .get_result::<Option<i32>>(connection)?;
1368    /// assert_eq!(None::<i32>, pos);
1369    ///
1370    /// let pos = diesel::select(array_position::<Array<_>, Nullable<Integer>, _, _>(
1371    ///     vec![1, 2, 3, 4], None::<i32>))
1372    ///     .get_result::<Option<i32>>(connection)?;
1373    /// assert_eq!(None::<i32>, pos);
1374    ///
1375    /// let pos = diesel::select(array_position::<Array<_>, Nullable<Integer>, _, _>(
1376    ///     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>))
1377    ///     .get_result::<Option<i32>>(connection)?;
1378    /// assert_eq!(Some(1), pos);
1379    ///
1380    /// let dims = diesel::select(array_position::<Nullable<Array<Integer>>, Integer, _, _>(None::<Vec<i32>>, 1))
1381    ///     .get_result::<Option<i32>>(connection)?;
1382    /// assert_eq!(None, dims);
1383    ///
1384    /// # Ok(())
1385    /// # }
1386    #[cfg(feature = "postgres_backend")]
1387    fn array_position<Arr: ArrayOrNullableArray<Inner = E> + SingleValue, E: SingleValue>(
1388        a: Arr,
1389        elem: E,
1390    ) -> Nullable<Integer>;
1391
1392    /// Returns the subscript of the first occurrence of the second argument in the array,
1393    /// or NULL if it's not present, beginning at the subscript given as the third argument.
1394    ///
1395    /// The array must be one-dimensional.
1396    /// Comparisons are done using IS NOT DISTINCT FROM semantics,
1397    /// so it is possible to search for NULL.
1398    /// # Example
1399    ///
1400    /// ```rust
1401    /// # include!("../../doctest_setup.rs");
1402    /// #
1403    /// # fn main(){
1404    /// #    run_test().unwrap();
1405    /// # }
1406    /// # fn run_test()->QueryResult<()>{
1407    /// #   use diesel::dsl::array_position_with_subscript;
1408    /// #   use diesel::sql_types::{Nullable,Array,Integer};
1409    /// #   let connection = &mut establish_connection();
1410    ///
1411    /// let pos = diesel::select(array_position_with_subscript::<Array<_>, Integer, _, _, _>(
1412    ///     vec![1, 2, 3, 4], 3, 2))
1413    ///     .get_result::<Option<i32>>(connection)?;
1414    /// assert_eq!(Some(3), pos);
1415    ///
1416    /// let pos = diesel::select(array_position_with_subscript::<Array<_>, Integer, _, _, _>(
1417    ///     vec![1, 2, 3, 4], 1, 2))
1418    ///     .get_result::<Option<i32>>(connection)?;
1419    /// assert_eq!(None::<i32>, pos);
1420    ///
1421    /// let pos = diesel::select(array_position_with_subscript::<Array<_>, Nullable<Integer>, _, _, _>(
1422    ///     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>, 1))
1423    ///     .get_result::<Option<i32>>(connection)?;
1424    /// assert_eq!(Some(1), pos);
1425    ///
1426    /// let pos = diesel::select(array_position_with_subscript::<Array<_>, Nullable<Integer>, _, _, _>(
1427    ///     vec![None::<i32>, Some(1), Some(2), Some(3)], None::<i32>, 2))
1428    ///     .get_result::<Option<i32>>(connection)?;
1429    /// assert_eq!(None::<i32>, pos);
1430    /// # Ok(())
1431    /// # }
1432    #[sql_name = "array_position"]
1433    #[cfg(feature = "postgres_backend")]
1434    fn array_position_with_subscript<
1435        Arr: ArrayOrNullableArray<Inner = E> + SingleValue,
1436        E: SingleValue,
1437    >(
1438        a: Arr,
1439        elem: E,
1440        subscript: Integer,
1441    ) -> Nullable<Integer>;
1442
1443    /// Returns an array of the subscripts of all occurrences of the second argument in the
1444    /// array given as first argument.
1445    ///
1446    /// The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics,
1447    /// so it is possible to search for NULL.
1448    /// NULL is returned only if the array is NULL; if the value is not found in the array, an empty array is returned.
1449    ///
1450    /// # Example
1451    ///
1452    /// ```rust
1453    /// # include!("../../doctest_setup.rs");
1454    /// #
1455    /// # fn main(){
1456    /// #    run_test().unwrap();
1457    /// # }
1458    /// # fn run_test()->QueryResult<()>{
1459    /// #   use diesel::dsl::array_positions;
1460    /// #   use diesel::sql_types::{Nullable,Array,Integer};
1461    /// #   let connection = &mut establish_connection();
1462    ///
1463    /// let pos = diesel::select(array_positions::<Array<_>, Integer, _, _>(vec![1, 1, 2, 1], 1))
1464    ///     .get_result::<Vec<i32>>(connection)?;
1465    /// assert_eq!(vec![1,2,4], pos);
1466    ///
1467    /// let pos = diesel::select(array_positions::<Array<_>, Integer, _, _>(vec![1, 2, 3, 4], 5))
1468    ///     .get_result::<Vec<i32>>(connection)?;
1469    /// assert_eq!(Vec::<i32>::new(), pos);
1470    ///
1471    /// let pos = diesel::select(array_positions::<Array<_>, Nullable<Integer>, _, _>(
1472    ///     vec![None::<i32>, Some(2), Some(3), None::<i32>], None::<i32>))
1473    ///     .get_result::<Vec<i32>>(connection)?;
1474    /// assert_eq!(vec![1,4], pos);
1475    ///
1476    /// let pos = diesel::select(array_positions::<Nullable<Array<_>>, Integer, _, _>(
1477    ///     None::<Vec<i32>>, 1))
1478    ///     .get_result::<Option<Vec<i32>>>(connection)?;
1479    /// assert_eq!(None::<Vec<i32>>, pos);
1480    /// # Ok(())
1481    /// # }
1482    #[cfg(feature = "postgres_backend")]
1483    fn array_positions<
1484        Arr: ArrayOrNullableArray<Inner = E> + SingleValue + MaybeNullableValue<Array<Integer>>,
1485        E: SingleValue,
1486    >(
1487        a: Arr,
1488        elem: E,
1489    ) -> Arr::Out;
1490
1491    /// Returns the number of dimensions of the array
1492    ///
1493    /// # Example
1494    ///
1495    /// ```rust
1496    /// # include!("../../doctest_setup.rs");
1497    /// #
1498    /// # fn main() {
1499    /// #     run_test().unwrap();
1500    /// # }
1501    /// #
1502    /// # fn run_test() -> QueryResult<()> {
1503    /// #     use diesel::dsl::array_ndims;
1504    /// #     use diesel::sql_types::{Nullable, Array, Integer};
1505    /// #     let connection = &mut establish_connection();
1506    ///
1507    /// // diesel currently only supports 1D arrays
1508    /// let dims = diesel::select(array_ndims::<Array<Integer>, _>(vec![1, 2]))
1509    ///     .get_result::<i32>(connection)?;
1510    /// assert_eq!(1, dims);
1511    ///
1512    /// let dims = diesel::select(array_ndims::<Nullable<Array<Integer>>, _>(None::<Vec<i32>>))
1513    ///     .get_result::<Option<i32>>(connection)?;
1514    /// assert_eq!(None, dims);
1515    ///
1516    /// #     Ok(())
1517    /// # }
1518    /// ```
1519    #[cfg(feature = "postgres_backend")]
1520    fn array_ndims<Arr: ArrayOrNullableArray + SingleValue + MaybeNullableValue<Integer>>(
1521        arr: Arr,
1522    ) -> Arr::Out;
1523
1524    /// Returns the upper bound of the requested array
1525    ///
1526    /// This function returns null for dimensions that do not exist
1527    ///
1528    /// # Example
1529    ///
1530    /// ```rust
1531    /// # include!("../../doctest_setup.rs");
1532    /// #
1533    /// # fn main() {
1534    /// #     run_test().unwrap();
1535    /// # }
1536    /// #
1537    /// # fn run_test() -> QueryResult<()> {
1538    /// #     use diesel::dsl::array_upper;
1539    /// #     use diesel::sql_types::{Integer, Array};
1540    /// #     let connection = &mut establish_connection();
1541    /// let result = diesel::select(array_upper::<Array<Integer>, _, _>(vec![1, 2, 3], 1))
1542    ///     .get_result::<Option<i32>>(connection)?;
1543    /// assert_eq!(Some(3), result);
1544    ///
1545    /// // the array has only one dimension
1546    /// let result = diesel::select(array_upper::<Array<Integer>, _, _>(vec![1, 2, 3], 2))
1547    ///     .get_result::<Option<i32>>(connection)?;
1548    /// assert_eq!(None, result);
1549    /// #     Ok(())
1550    /// # }
1551    /// ```
1552    #[cfg(feature = "postgres_backend")]
1553    fn array_upper<Arr: ArrayOrNullableArray + SingleValue>(
1554        array: Arr,
1555        dimension: Integer,
1556    ) -> Nullable<Integer>;
1557
1558    /// Randomly shuffles the first dimension of the array.
1559    ///
1560    /// # Example
1561    // This function requires postgres >= 16.0
1562    // which we cannot expect to be widely used at the
1563    // point of writing this comment, so we skip running this test
1564    /// ```rust,no_run
1565    /// # include!("../../doctest_setup.rs");
1566    /// #
1567    /// # fn main() {
1568    /// #     run_test().unwrap();
1569    /// # }
1570    /// #
1571    /// # fn run_test() -> QueryResult<()> {
1572    /// #     use diesel::dsl::array_shuffle;
1573    /// #     use diesel::sql_types::{Array, Integer};
1574    /// #     let connection = &mut establish_connection();
1575    /// let shuffled = diesel::select(array_shuffle::<Array<Integer>, _>(vec![1, 2, 3, 4, 5]))
1576    ///     .get_result::<Vec<i32>>(connection)?;
1577    /// assert_eq!(5, shuffled.len());
1578    /// assert_eq!(shuffled.iter().sum::<i32>(), 15);
1579    /// #     Ok(())
1580    /// # }
1581    /// ```
1582    #[cfg(feature = "postgres_backend")]
1583    fn array_shuffle<Arr: ArrayOrNullableArray + SingleValue>(array: Arr) -> Arr;
1584
1585    /// Returns an array of n items randomly selected from array.
1586    /// n may not exceed the length of the array.
1587    ///
1588    /// # Example
1589    // This function requires postgres >= 16.0
1590    // which we cannot expect to be widely used at the
1591    // point of writing this comment, so we skip running this test
1592    /// ```rust,no_run
1593    /// # include!("../../doctest_setup.rs");
1594    /// #
1595    /// # fn main() {
1596    /// #     run_test().unwrap();
1597    /// # }
1598    /// #
1599    /// # fn run_test() -> QueryResult<()> {
1600    /// #     use diesel::dsl::array_sample;
1601    /// #     use diesel::sql_types::{Array, Integer, Nullable};
1602    /// #     let connection = &mut establish_connection();
1603    ///
1604    /// let vec = vec![1, 2, 3, 4, 5];
1605    /// let sampled = diesel::select(array_sample::<Array<Integer>, _, _>(vec.clone(), 3))
1606    ///     .get_result::<Vec<i32>>(connection)?;
1607    /// assert_eq!(3, sampled.len());
1608    /// assert!(sampled.iter().all(|x| vec.contains(x)));
1609    ///
1610    /// let vec: Vec<i32> = Vec::new();
1611    /// let sampled = diesel::select(array_sample::<Array<Integer>, _, _>(vec, 0))
1612    ///     .get_result::<Vec<i32>>(connection)?;
1613    /// assert_eq!(0, sampled.len());
1614    ///
1615    /// let sampled = diesel::select(array_sample::<Nullable<Array<Integer>>, _, _>(
1616    ///     None::<Vec<i32>>,
1617    ///     1,
1618    /// ))
1619    /// .get_result::<Option<Vec<i32>>>(connection)?;
1620    /// assert!(sampled.is_none());
1621    /// #     Ok(())
1622    /// # }
1623    /// ```
1624    #[cfg(feature = "postgres_backend")]
1625    fn array_sample<Arr: ArrayOrNullableArray + SingleValue>(array: Arr, n: Integer) -> Arr;
1626
1627    /// Converts any Array to json.
1628    ///
1629    /// # Example
1630    ///
1631    /// ```rust
1632    /// # include!("../../doctest_setup.rs");
1633    /// #
1634    /// # fn main() {
1635    /// #     #[cfg(feature = "serde_json")]
1636    /// #     run_test().unwrap();
1637    /// # }
1638    /// #
1639    /// # #[cfg(feature = "serde_json")]
1640    /// # fn run_test() -> QueryResult<()> {
1641    /// #     use diesel::dsl::array_to_json;
1642    /// #     use diesel::sql_types::{Array, Integer, Text, Nullable};
1643    /// #     use serde_json::Value;
1644    /// #     let connection = &mut establish_connection();
1645    /// let json = diesel::select(array_to_json::<Array<Integer>, _>(vec![1, 2, 3, 4, 5]))
1646    ///     .get_result::<Value>(connection)?;
1647    /// let expected: Value = serde_json::json!([1, 2, 3, 4, 5]);
1648    /// assert_eq!(expected, json);
1649    /// let json = diesel::select(array_to_json::<Array<Text>, _>(vec![
1650    ///     "hello", "world", "John", "Doe",
1651    /// ]))
1652    /// .get_result::<Value>(connection)?;
1653    /// let expected: Value = serde_json::json!(["hello", "world", "John", "Doe"]);
1654    /// assert_eq!(expected, json);
1655    /// let empty: Vec<String> = Vec::new();
1656    /// let json = diesel::select(array_to_json::<Array<Nullable<Text>>, _>(empty))
1657    ///     .get_result::<Value>(connection)?;
1658    /// assert_eq!(serde_json::json!([]), json);
1659    /// let json = diesel::select(array_to_json::<Nullable<Array<Integer>>, _>(
1660    ///     None::<Vec<i32>>,
1661    /// ))
1662    /// .get_result::<Option<Value>>(connection)?;
1663    /// assert_eq!(None, json);
1664    /// #     Ok(())
1665    /// # }
1666    /// ```
1667    #[cfg(feature = "postgres_backend")]
1668    fn array_to_json<Arr: ArrayOrNullableArray + MaybeNullableValue<Json>>(array: Arr) -> Arr::Out;
1669
1670    /// Converts any SQL value to json
1671    ///
1672    /// # Example
1673    ///
1674    /// ```rust
1675    /// # include!("../../doctest_setup.rs");
1676    /// #
1677    /// # fn main() {
1678    /// #     #[cfg(feature = "serde_json")]
1679    /// #     run_test().unwrap();
1680    /// # }
1681    /// #
1682    /// # #[cfg(feature = "serde_json")]
1683    /// # fn run_test() -> QueryResult<()> {
1684    /// #     use diesel::dsl::to_json;
1685    /// #     use serde_json::{json, Value};
1686    /// #     use diesel::sql_types::{Integer, Array, Json, Text, Nullable};
1687    /// #     let connection = &mut establish_connection();
1688    /// let result = diesel::select(to_json::<Integer, _>(1)).get_result::<Value>(connection)?;
1689    ///
1690    /// assert_eq!(json!(1), result);
1691    ///
1692    /// let result = diesel::select(to_json::<Array<Text>, _>(vec!["abc", "xyz"]))
1693    ///     .get_result::<Value>(connection)?;
1694    ///
1695    /// assert_eq!(json!(["abc", "xyz"]), result);
1696    ///
1697    /// let result = diesel::select(to_json::<Array<Nullable<Text>>, _>(Vec::<String>::new()))
1698    ///     .get_result::<Value>(connection)?;
1699    ///
1700    /// assert_eq!(json!([]), result);
1701    ///
1702    /// let result = diesel::select(to_json::<Nullable<Text>, _>(None::<String>))
1703    ///     .get_result::<Option<Value>>(connection)?;
1704    ///
1705    /// assert!(result.is_none());
1706    ///
1707    /// #     Ok(())
1708    /// # }
1709    /// ```
1710    #[cfg(feature = "postgres_backend")]
1711    fn to_json<E: MaybeNullableValue<Json>>(e: E) -> E::Out;
1712
1713    /// Converts any SQL value to jsonb
1714    ///
1715    /// # Example
1716    ///
1717    /// ```rust
1718    /// # include!("../../doctest_setup.rs");
1719    /// #
1720    /// # fn main() {
1721    /// #     #[cfg(feature = "serde_json")]
1722    /// #     run_test().unwrap();
1723    /// # }
1724    /// #
1725    /// # #[cfg(feature = "serde_json")]
1726    /// # fn run_test() -> QueryResult<()> {
1727    /// #     use diesel::dsl::to_jsonb;
1728    /// #     use serde_json::{json, Value};
1729    /// #     use diesel::sql_types::{Integer, Array, Jsonb, Text, Nullable};
1730    /// #     let connection = &mut establish_connection();
1731    /// let result = diesel::select(to_jsonb::<Integer, _>(1)).get_result::<Value>(connection)?;
1732    ///
1733    /// assert_eq!(json!(1), result);
1734    ///
1735    /// let result = diesel::select(to_jsonb::<Array<Text>, _>(vec!["abc", "def"]))
1736    ///     .get_result::<Value>(connection)?;
1737    ///
1738    /// assert_eq!(json!(["abc", "def"]), result);
1739    ///
1740    /// let result = diesel::select(to_jsonb::<Array<Nullable<Text>>, _>(Vec::<String>::new()))
1741    ///     .get_result::<Value>(connection)?;
1742    ///
1743    /// assert_eq!(json!([]), result);
1744    ///
1745    /// let result = diesel::select(to_jsonb::<Nullable<Text>, _>(None::<String>))
1746    ///     .get_result::<Option<Value>>(connection)?;
1747    ///
1748    /// assert!(result.is_none());
1749    ///
1750    /// #     Ok(())
1751    /// # }
1752    /// ```
1753    #[cfg(feature = "postgres_backend")]
1754    fn to_jsonb<E: MaybeNullableValue<Jsonb>>(e: E) -> E::Out;
1755
1756    /// Builds a JSON object out of a text array. The array must have an even number of members,
1757    /// in which case they are taken as alternating key/value pairs
1758    ///
1759    /// # Example
1760    ///
1761    /// ```rust
1762    /// # include!("../../doctest_setup.rs");
1763    /// #
1764    /// # fn main() {
1765    /// #     #[cfg(feature = "serde_json")]
1766    /// #     run_test().unwrap();
1767    /// # }
1768    /// #
1769    /// # #[cfg(feature = "serde_json")]
1770    /// # fn run_test() -> QueryResult<()> {
1771    /// #     use diesel::dsl::json_object;
1772    /// #     use diesel::sql_types::{Array, Json, Nullable, Text};
1773    /// #     use serde_json::Value;
1774    /// #     let connection = &mut establish_connection();
1775    /// let json = diesel::select(json_object::<Array<Text>,_>(vec!["hello","world"]))
1776    ///                 .get_result::<Value>(connection)?;
1777    /// let expected:Value = serde_json::json!({"hello":"world"});
1778    /// assert_eq!(expected,json);
1779    ///
1780    /// let json = diesel::select(json_object::<Array<Text>,_>(vec!["hello","world","John","Doe"]))
1781    ///                 .get_result::<Value>(connection)?;
1782    /// let expected:Value = serde_json::json!({"hello":"world","John":"Doe"});
1783    /// assert_eq!(expected,json);
1784    ///
1785    /// let json = diesel::select(json_object::<Array<Text>,_>(vec!["hello","world","John"]))
1786    ///                 .get_result::<Value>(connection);
1787    /// assert!(json.is_err());
1788    ///
1789    /// let empty:Vec<String> = Vec::new();
1790    /// let json = diesel::select(json_object::<Array<Nullable<Text>>,_>(empty))
1791    ///                 .get_result::<Value>(connection);
1792    /// assert!(json.is_err());
1793    ///
1794    /// #     Ok(())
1795    /// # }
1796    /// ```
1797    #[cfg(feature = "postgres_backend")]
1798    fn json_object<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Json>>(
1799        text_array: Arr,
1800    ) -> Arr::Out;
1801
1802    /// This form of json_object takes keys and values pairwise from two separate arrays.
1803    /// In all other respects it is identical to the one-argument form.
1804    ///
1805    /// # Example
1806    ///
1807    /// ```rust
1808    /// # include!("../../doctest_setup.rs");
1809    /// #
1810    /// # fn main() {
1811    /// #     #[cfg(feature = "serde_json")]
1812    /// #     run_test().unwrap();
1813    /// # }
1814    /// #
1815    /// # #[cfg(feature = "serde_json")]
1816    /// # fn run_test() -> QueryResult<()> {
1817    /// #     use diesel::dsl::json_object_with_keys_and_values;
1818    /// #     use diesel::sql_types::{Array, Json, Nullable, Text};
1819    /// #     use serde_json::Value;
1820    /// #     let connection = &mut establish_connection();
1821    /// let json = diesel::select(json_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>(
1822    ///             vec!["hello","John"],vec!["world","Doe"]))
1823    ///             .get_result::<Value>(connection)?;
1824    /// let expected:Value = serde_json::json!({"hello":"world","John":"Doe"});
1825    /// assert_eq!(expected,json);
1826    ///
1827    /// let json = diesel::select(json_object_with_keys_and_values::<Nullable<Array<Text>>, Nullable<Array<Text>>, _, _>(
1828    ///             Some(vec!["hello","John"]), None::<Vec<String>>))
1829    ///             .get_result::<Option<Value>>(connection)?;
1830    /// assert_eq!(None::<Value>,json);
1831    ///
1832    /// let empty: Vec<String> = Vec::new();
1833    /// let json = diesel::select(json_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>(
1834    ///             vec!["hello","John"], empty))
1835    ///             .get_result::<Value>(connection);
1836    /// assert!(json.is_err());
1837    ///
1838    /// #     Ok(())
1839    /// # }
1840    /// ```
1841    #[sql_name = "json_object"]
1842    #[cfg(feature = "postgres_backend")]
1843    fn json_object_with_keys_and_values<
1844        Arr1: TextArrayOrNullableTextArray + SingleValue,
1845        Arr2: TextArrayOrNullableTextArray + CombinedNullableValue<Arr1, Json>,
1846    >(
1847        keys: Arr1,
1848        values: Arr2,
1849    ) -> Arr2::Out;
1850
1851    /// Returns the type of the top-level json value as a text-string
1852    ///
1853    /// # Example
1854    ///
1855    /// ```rust
1856    /// # include!("../../doctest_setup.rs");
1857    /// #
1858    /// # fn main() {
1859    /// #     #[cfg(feature = "serde_json")]
1860    /// #     run_test().unwrap();
1861    /// # }
1862    /// #
1863    /// # #[cfg(feature = "serde_json")]
1864    /// # fn run_test() -> QueryResult<()> {
1865    /// #     use diesel::dsl::json_typeof;
1866    /// #     use serde_json::{json, Value};
1867    /// #     use diesel::sql_types::{Json, Nullable};
1868    /// #     let connection = &mut establish_connection();
1869    /// let result = diesel::select(json_typeof::<Json, _>(json!({"a": "b", "c": 1})))
1870    ///     .get_result::<String>(connection)?;
1871    ///
1872    /// assert_eq!("object".to_string(), result);
1873    ///
1874    /// let result = diesel::select(json_typeof::<Json, _>(json!([1,2,3])))
1875    ///     .get_result::<String>(connection)?;
1876    ///
1877    /// assert_eq!("array".to_string(), result);
1878    ///
1879    /// let result = diesel::select(json_typeof::<Json, _>(json!("abc")))
1880    ///     .get_result::<String>(connection)?;
1881    ///
1882    /// assert_eq!("string".to_string(), result);
1883    ///
1884    /// let result = diesel::select(json_typeof::<Json, _>(json!(-123.4)))
1885    ///     .get_result::<String>(connection)?;
1886    ///
1887    /// assert_eq!("number".to_string(), result);
1888    ///
1889    /// let result = diesel::select(json_typeof::<Json, _>(json!(true)))
1890    ///     .get_result::<String>(connection)?;
1891    ///
1892    /// assert_eq!("boolean".to_string(), result);
1893    ///
1894    /// let result = diesel::select(json_typeof::<Json, _>(json!(null)))
1895    ///     .get_result::<String>(connection)?;
1896    ///
1897    /// assert_eq!("null".to_string(), result);
1898    ///
1899    /// let result = diesel::select(json_typeof::<Nullable<Json>, _>(None::<Value>))
1900    ///     .get_result::<Option<String>>(connection)?;
1901    ///
1902    /// assert!(result.is_none());
1903    /// #     Ok(())
1904    /// # }
1905    /// ```
1906    #[cfg(feature = "postgres_backend")]
1907    fn json_typeof<E: JsonOrNullableJson + SingleValue + MaybeNullableValue<Text>>(e: E) -> E::Out;
1908
1909    /// Returns the type of the top-level jsonb value as a text-string
1910    ///
1911    /// # Example
1912    ///
1913    /// ```rust
1914    /// # include!("../../doctest_setup.rs");
1915    /// #
1916    /// # fn main() {
1917    /// #     #[cfg(feature = "serde_json")]
1918    /// #     run_test().unwrap();
1919    /// # }
1920    /// #
1921    /// # #[cfg(feature = "serde_json")]
1922    /// # fn run_test() -> QueryResult<()> {
1923    /// #     use diesel::dsl::jsonb_typeof;
1924    /// #     use serde_json::{json, Value};
1925    /// #     use diesel::sql_types::{Jsonb, Nullable};
1926    /// #     let connection = &mut establish_connection();
1927    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!({"a": "b", "c": 1})))
1928    ///     .get_result::<String>(connection)?;
1929    ///
1930    /// assert_eq!("object".to_string(), result);
1931    ///
1932    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!([1,2,3])))
1933    ///     .get_result::<String>(connection)?;
1934    ///
1935    /// assert_eq!("array".to_string(), result);
1936    ///
1937    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!("abc")))
1938    ///     .get_result::<String>(connection)?;
1939    ///
1940    /// assert_eq!("string".to_string(), result);
1941    ///
1942    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(-123.4)))
1943    ///     .get_result::<String>(connection)?;
1944    ///
1945    /// assert_eq!("number".to_string(), result);
1946    ///
1947    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(true)))
1948    ///     .get_result::<String>(connection)?;
1949    ///
1950    /// assert_eq!("boolean".to_string(), result);
1951    ///
1952    /// let result = diesel::select(jsonb_typeof::<Jsonb, _>(json!(null)))
1953    ///     .get_result::<String>(connection)?;
1954    ///
1955    /// assert_eq!("null".to_string(), result);
1956    ///
1957    /// let result = diesel::select(jsonb_typeof::<Nullable<Jsonb>, _>(None::<Value>))
1958    ///     .get_result::<Option<String>>(connection)?;
1959    ///
1960    /// assert!(result.is_none());
1961    /// #     Ok(())
1962    /// # }
1963    /// ```
1964    #[cfg(feature = "postgres_backend")]
1965    fn jsonb_typeof<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>>(
1966        e: E,
1967    ) -> E::Out;
1968
1969    /// Converts the given json value to pretty-printed, indented text
1970    ///
1971    /// # Example
1972    ///
1973    /// ```rust
1974    /// # include!("../../doctest_setup.rs");
1975    /// #
1976    /// # fn main() {
1977    /// #     #[cfg(feature = "serde_json")]
1978    /// #     run_test().unwrap();
1979    /// # }
1980    /// #
1981    /// # #[cfg(feature = "serde_json")]
1982    /// # fn run_test() -> QueryResult<()> {
1983    /// #     use diesel::dsl::jsonb_pretty;
1984    /// #     use serde_json::{json, Value};
1985    /// #     use diesel::sql_types::{Jsonb, Nullable};
1986    /// #     let connection = &mut establish_connection();
1987    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!([{"f1":1,"f2":null},2,null,3])))
1988    ///     .get_result::<String>(connection)?;
1989    ///
1990    /// assert_eq!(r#"[
1991    ///     {
1992    ///         "f1": 1,
1993    ///         "f2": null
1994    ///     },
1995    ///     2,
1996    ///     null,
1997    ///     3
1998    /// ]"#, result);
1999    ///
2000    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!({"a": 1, "b": "cd"})))
2001    ///     .get_result::<String>(connection)?;
2002    ///
2003    /// assert_eq!(r#"{
2004    ///     "a": 1,
2005    ///     "b": "cd"
2006    /// }"#, result);
2007    ///
2008    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!("abc")))
2009    ///     .get_result::<String>(connection)?;
2010    ///
2011    /// assert_eq!(r#""abc""#, result);
2012    ///
2013    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(22)))
2014    ///     .get_result::<String>(connection)?;
2015    ///
2016    /// assert_eq!(r#"22"#, result);
2017    ///
2018    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(false)))
2019    ///     .get_result::<String>(connection)?;
2020    ///
2021    /// assert_eq!(r#"false"#, result);
2022    ///
2023    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!(null)))
2024    ///     .get_result::<String>(connection)?;
2025    ///
2026    /// assert_eq!(r#"null"#, result);
2027    ///
2028    /// let result = diesel::select(jsonb_pretty::<Jsonb, _>(json!({})))
2029    ///     .get_result::<String>(connection)?;
2030    ///
2031    /// assert_eq!(r#"{
2032    /// }"#, result);
2033    ///
2034    /// let result = diesel::select(jsonb_pretty::<Nullable<Jsonb>, _>(None::<Value>))
2035    ///     .get_result::<Option<String>>(connection)?;
2036    ///
2037    /// assert!(result.is_none());
2038    /// #     Ok(())
2039    /// # }
2040    /// ```
2041    #[cfg(feature = "postgres_backend")]
2042    fn jsonb_pretty<E: JsonbOrNullableJsonb + SingleValue + MaybeNullableValue<Text>>(
2043        e: E,
2044    ) -> E::Out;
2045
2046    /// Deletes all object fields that have null values from the given JSON value, recursively.
2047    ///
2048    /// # Example
2049    ///
2050    /// ```rust
2051    /// # include!("../../doctest_setup.rs");
2052    /// #
2053    /// # fn main() {
2054    /// #     #[cfg(feature = "serde_json")]
2055    /// #     run_test().unwrap();
2056    /// # }
2057    /// #
2058    /// # #[cfg(feature = "serde_json")]
2059    /// # fn run_test() -> QueryResult<()> {
2060    /// #     use diesel::dsl::json_strip_nulls;
2061    /// #     use diesel::sql_types::{Json, Nullable};
2062    /// #     use serde_json::{json, Value};
2063    /// #     let connection = &mut establish_connection();
2064    ///
2065    /// let result = diesel::select(json_strip_nulls::<Json, _>(json!({"hello": null})))
2066    ///     .get_result::<Value>(connection)?;
2067    /// let expected: Value = json!({});
2068    /// assert_eq!(result, expected);
2069    ///
2070    /// let result = diesel::select(json_strip_nulls::<Json, _>(json!([{"f1":1, "f2":null}, 2, null, 3])))
2071    ///     .get_result::<Value>(connection)?;
2072    /// let expected: Value = json!([{"f1":1}, 2, null, 3]);
2073    /// assert_eq!(result, expected);
2074    ///
2075    /// let result = diesel::select(json_strip_nulls::<Nullable<Json>, _>(None::<Value>))
2076    ///     .get_result::<Option<Value>>(connection)?;
2077    /// assert!(result.is_none());
2078    ///
2079    /// let result = diesel::select(json_strip_nulls::<Json, _>(json!(null)))
2080    ///     .get_result::<Value>(connection)?;
2081    /// let expected = json!(null);
2082    /// assert_eq!(result, expected);
2083    ///
2084    ///
2085    /// #     Ok(())
2086    /// # }
2087    /// ```
2088    #[cfg(feature = "postgres_backend")]
2089    fn json_strip_nulls<E: JsonOrNullableJson + SingleValue>(json: E) -> E;
2090
2091    /// Deletes all object fields that have null values from the given JSON value, recursively.
2092    ///
2093    /// # Example
2094    ///
2095    /// ```rust
2096    /// # include!("../../doctest_setup.rs");
2097    /// #
2098    /// # fn main() {
2099    /// #     #[cfg(feature = "serde_json")]
2100    /// #     run_test().unwrap();
2101    /// # }
2102    /// #
2103    /// # #[cfg(feature = "serde_json")]
2104    /// # fn run_test() -> QueryResult<()> {
2105    /// #     use diesel::dsl::jsonb_strip_nulls;
2106    /// #     use diesel::sql_types::{Jsonb, Nullable};
2107    /// #     use serde_json::{json, Value};
2108    /// #     let connection = &mut establish_connection();
2109    ///
2110    /// let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!({"hello": null})))
2111    ///     .get_result::<Value>(connection)?;
2112    /// let expected: Value = json!({});
2113    /// assert_eq!(result, expected);
2114    ///
2115    /// let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!([{"f1":1, "f2":null}, 2, null, 3])))
2116    ///     .get_result::<Value>(connection)?;
2117    /// let expected: Value = json!([{"f1":1}, 2, null, 3]);
2118    /// assert_eq!(result, expected);
2119    ///
2120    /// let result = diesel::select(jsonb_strip_nulls::<Nullable<Jsonb>, _>(None::<Value>))
2121    ///     .get_result::<Option<Value>>(connection)?;
2122    /// assert!(result.is_none());
2123    ///
2124    /// let result = diesel::select(jsonb_strip_nulls::<Jsonb, _>(json!(null)))
2125    ///     .get_result::<Value>(connection)?;
2126    /// let expected = json!(null);
2127    /// assert_eq!(result, expected);
2128    ///
2129    ///
2130    ///
2131    /// #     Ok(())
2132    /// # }
2133    /// ```
2134    #[cfg(feature = "postgres_backend")]
2135    fn jsonb_strip_nulls<E: JsonbOrNullableJsonb + SingleValue>(jsonb: E) -> E;
2136
2137    /// Returns the number of elements in the top-level JSON array
2138    ///
2139    ///
2140    /// # Example
2141    ///
2142    /// ```rust
2143    /// # include!("../../doctest_setup.rs");
2144    /// #
2145    /// # fn main() {
2146    /// #     #[cfg(feature = "serde_json")]
2147    /// #     run_test().unwrap();
2148    /// # }
2149    /// #
2150    /// # #[cfg(feature = "serde_json")]
2151    /// # fn run_test() -> QueryResult<()> {
2152    /// #     use diesel::dsl::json_array_length;
2153    /// #     use serde_json::{json, Value};
2154    /// #     use diesel::sql_types::{Integer, Json, Nullable};
2155    /// #     let connection = &mut establish_connection();
2156    ///
2157    /// let result = diesel::select(json_array_length::<Json, _>(json!([1, 2, 3])))
2158    ///     .get_result::<i32>(connection)?;
2159    /// assert_eq!(result, 3);
2160    ///
2161    /// let result =
2162    ///     diesel::select(json_array_length::<Json, _>(json!([]))).get_result::<i32>(connection)?;
2163    /// assert_eq!(result, 0);
2164    ///
2165    /// let result = diesel::select(json_array_length::<Nullable<Json>, _>(None::<Value>))
2166    ///     .get_result::<Option<i32>>(connection)?;
2167    /// assert!(result.is_none());
2168    ///
2169    /// #     Ok(())
2170    /// # }
2171    /// ```
2172    #[cfg(feature = "postgres_backend")]
2173    fn json_array_length<E: JsonOrNullableJson + MaybeNullableValue<Integer>>(json: E) -> E::Out;
2174
2175    /// Returns the number of elements in the top-level JSON array
2176    ///
2177    ///
2178    /// # Example
2179    ///
2180    /// ```rust
2181    /// # include!("../../doctest_setup.rs");
2182    /// #
2183    /// # fn main() {
2184    /// #     #[cfg(feature = "serde_json")]
2185    /// #     run_test().unwrap();
2186    /// # }
2187    /// #
2188    /// # #[cfg(feature = "serde_json")]
2189    /// # fn run_test() -> QueryResult<()> {
2190    /// #     use diesel::dsl::jsonb_array_length;
2191    /// #     use serde_json::{json, Value};
2192    /// #     use diesel::sql_types::{Integer, Jsonb, Nullable};
2193    /// #     let connection = &mut establish_connection();
2194    ///
2195    /// let result = diesel::select(jsonb_array_length::<Jsonb, _>(json!([1, 2, 3])))
2196    ///     .get_result::<i32>(connection)?;
2197    /// assert_eq!(result, 3);
2198    ///
2199    /// let result =
2200    ///     diesel::select(jsonb_array_length::<Jsonb, _>(json!([]))).get_result::<i32>(connection)?;
2201    /// assert_eq!(result, 0);
2202    ///
2203    /// let result = diesel::select(jsonb_array_length::<Nullable<Jsonb>, _>(None::<Value>))
2204    ///     .get_result::<Option<i32>>(connection)?;
2205    /// assert!(result.is_none());
2206    ///
2207    /// #     Ok(())
2208    /// # }
2209    /// ```
2210    #[cfg(feature = "postgres_backend")]
2211    fn jsonb_array_length<E: JsonbOrNullableJsonb + MaybeNullableValue<Integer>>(
2212        jsonb: E,
2213    ) -> E::Out;
2214    /// Builds a JSON object out of a text array. The array must have an even number of members,
2215    /// in which case they are taken as alternating key/value pairs. This function also has a form that
2216    /// that takes keys and values as separate text array arguments.
2217    /// See [jsonb_object_with_keys_and_values](jsonb_object_with_keys_and_values())
2218    ///
2219    /// # Example
2220    ///
2221    /// ```rust
2222    /// # include!("../../doctest_setup.rs");
2223    /// #
2224    /// # fn main() {
2225    /// #     #[cfg(feature = "serde_json")]
2226    /// #     run_test().unwrap();
2227    /// # }
2228    /// #
2229    /// # #[cfg(feature = "serde_json")]
2230    /// # fn run_test() -> QueryResult<()> {
2231    /// #     use diesel::dsl::jsonb_object;
2232    /// #     use diesel::sql_types::{Array, Json, Nullable, Text};
2233    /// #     use serde_json::Value;
2234    /// #     let connection = &mut establish_connection();
2235    /// let jsonb = diesel::select(jsonb_object::<Array<Text>,_>(vec!["hello","world"]))
2236    ///                 .get_result::<Value>(connection)?;
2237    /// let expected:Value = serde_json::json!({"hello":"world"});
2238    /// assert_eq!(expected, jsonb);
2239    ///
2240    /// let jsonb = diesel::select(jsonb_object::<Array<Text>, _>(vec!["hello","world","John","Doe"]))
2241    ///                 .get_result::<Value>(connection)?;
2242    /// let expected:Value = serde_json::json!({"hello": "world","John": "Doe"});
2243    /// assert_eq!(expected, jsonb);
2244    ///
2245    /// let jsonb = diesel::select(jsonb_object::<Nullable<Array<Text>>, _>(None::<Vec<String>>))
2246    ///                 .get_result::<Option<Value>>(connection)?;
2247    /// assert!(jsonb.is_none());
2248    ///
2249    /// let empty:Vec<String> = Vec::new();
2250    /// let jsonb = diesel::select(jsonb_object::<Array<Nullable<Text>>,_>(empty))
2251    ///                 .get_result::<Value>(connection)?;
2252    /// let expected = serde_json::json!({});
2253    /// assert_eq!(expected, jsonb);
2254    ///
2255    /// let jsonb = diesel::select(jsonb_object::<Array<Text>, _>(vec!["hello","world","John"]))
2256    ///                 .get_result::<Value>(connection);
2257    /// assert!(jsonb.is_err());
2258    ///
2259    ///
2260    /// #     Ok(())
2261    /// # }
2262    /// ```
2263    #[cfg(feature = "postgres_backend")]
2264    fn jsonb_object<Arr: TextArrayOrNullableTextArray + MaybeNullableValue<Jsonb>>(
2265        text_array: Arr,
2266    ) -> Arr::Out;
2267
2268    /// This form of jsonb_object takes keys and values pairwise from two separate arrays.
2269    /// In all other respects it is identical to the one-argument form.
2270    ///
2271    /// # Example
2272    ///
2273    /// ```rust
2274    /// # include!("../../doctest_setup.rs");
2275    /// #
2276    /// # fn main() {
2277    /// #     #[cfg(feature = "serde_json")]
2278    /// #     run_test().unwrap();
2279    /// # }
2280    /// #
2281    /// # #[cfg(feature = "serde_json")]
2282    /// # fn run_test() -> QueryResult<()> {
2283    /// #     use diesel::dsl::jsonb_object_with_keys_and_values;
2284    /// #     use diesel::sql_types::{Array, Nullable, Text};
2285    /// #     use serde_json::Value;
2286    /// #     let connection = &mut establish_connection();
2287    /// let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>(
2288    ///             vec!["hello","John"],vec!["world","Doe"]))
2289    ///             .get_result::<Value>(connection)?;
2290    /// let expected:Value = serde_json::json!({"hello":"world","John":"Doe"});
2291    /// assert_eq!(expected, jsonb);
2292    ///
2293    /// let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Nullable<Array<Text>>, Nullable<Array<Text>>, _, _>(
2294    ///             Some(vec!["hello","John"]),None::<Vec<String>>))
2295    ///             .get_result::<Option<Value>>(connection)?;
2296    /// assert_eq!(None::<Value>,jsonb);
2297    ///
2298    /// let empty: Vec<String> = Vec::new();
2299    /// let jsonb = diesel::select(jsonb_object_with_keys_and_values::<Array<Text>, Array<Text>, _, _>(
2300    ///             vec!["hello","John"],empty))
2301    ///             .get_result::<Value>(connection);
2302    /// assert!(jsonb.is_err());
2303    ///
2304    /// #     Ok(())
2305    /// # }
2306    /// ```
2307    #[sql_name = "jsonb_object"]
2308    #[cfg(feature = "postgres_backend")]
2309    fn jsonb_object_with_keys_and_values<
2310        Arr1: TextArrayOrNullableTextArray + SingleValue,
2311        Arr2: TextArrayOrNullableTextArray + CombinedNullableValue<Arr1, Jsonb>,
2312    >(
2313        keys: Arr1,
2314        values: Arr2,
2315    ) -> Arr2::Out;
2316
2317    /// This function `row_to_json` takes a Record type as an input and converts it to JSON.
2318    ///
2319    /// # Example
2320    ///
2321    /// ```rust
2322    /// # include!("../../doctest_setup.rs");
2323    /// #
2324    /// # fn main() {
2325    /// #     #[cfg(feature = "serde_json")]
2326    /// #     run_test().unwrap();
2327    /// # }
2328    /// #
2329    /// # #[cfg(feature = "serde_json")]
2330    /// # fn run_test() -> QueryResult<()> {
2331    /// #     use diesel::dsl::row_to_json;
2332    /// #     use diesel::dsl::sql;
2333    /// #     use diesel::sql_types::{Record, Text, Integer};
2334    /// #     use serde_json::Value;
2335    /// #     let connection = &mut establish_connection();
2336    ///
2337    /// let json_value = diesel::select(row_to_json(sql::<Record<(Text, Integer)>>(
2338    ///     "ROW('John', 30)"
2339    /// )))
2340    /// .get_result::<Value>(connection)?;
2341    /// let expected: Value = serde_json::json!({
2342    ///     "f1": "John",
2343    ///     "f2": 30
2344    /// });
2345    /// assert_eq!(expected, json_value);
2346    ///
2347    /// let json_value = diesel::select(row_to_json(sql::<Record<()>>("ROW()")))
2348    /// .get_result::<Value>(connection)?;
2349    /// let expected: Value = serde_json::json!({});
2350    /// assert_eq!(expected, json_value);
2351    ///
2352    /// #    Ok(())
2353    /// # }
2354    /// ```
2355    #[sql_name = "row_to_json"]
2356    #[cfg(feature = "postgres_backend")]
2357    fn row_to_json<R: RecordOrNullableRecord + MaybeNullableValue<Json>>(record: R) -> R::Out;
2358
2359    /// This function `json_populate_record` takes a Record base and Json as an input and converts it to top-level
2360    /// JSON object to a row having the composite type of the base argument.
2361    ///
2362    /// # Example
2363    ///
2364    /// ```rust
2365    /// # include!("../../doctest_setup.rs");
2366    /// #
2367    /// # fn main() {
2368    /// #     #[cfg(feature = "serde_json")]
2369    /// #     run_test().unwrap();
2370    /// # }
2371    /// #
2372    /// # #[cfg(feature = "serde_json")]
2373    /// # fn run_test() -> QueryResult<()> {
2374    /// #     use diesel::dsl::json_populate_record;
2375    /// #     use diesel::dsl::sql;
2376    /// #     use diesel::sql_types::{Record, Text, Integer, Json};
2377    /// #     use serde_json::Value;
2378    /// #     let connection = &mut establish_connection();
2379    ///
2380    /// let expected: Value = serde_json::json!({
2381    ///     "f1": "Alice",
2382    ///     "f2": 16
2383    /// });
2384    /// let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>(
2385    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2386    ///         expected
2387    /// )).get_result(connection)?;
2388    /// assert_eq!(record, ("Alice".to_string(), 16));
2389    ///
2390    /// let expected: Value = serde_json::json!({});
2391    /// let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>(
2392    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2393    ///         expected
2394    /// )).get_result(connection)?;
2395    /// assert_eq!(record, ("John".to_string(), 30));
2396    ///
2397    /// let expected: Value = serde_json::json!({
2398    ///     "f1": "Alice"
2399    /// });
2400    /// let record: (String, i32) = diesel::select(json_populate_record::<Record<(Text, Integer)>, Json, _, _>(
2401    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2402    ///         expected
2403    /// )).get_result(connection)?;
2404    /// assert_eq!(record, ("Alice".to_string(), 30));
2405    ///
2406    /// #    Ok(())
2407    /// # }
2408    /// ```
2409    #[sql_name = "json_populate_record"]
2410    #[cfg(feature = "postgres_backend")]
2411    fn json_populate_record<
2412        B: RecordOrNullableRecord + SingleValue,
2413        J: JsonOrNullableJson + CombinedAllNullableValue<Json, B>,
2414    >(
2415        base: B,
2416        from_json: J,
2417    ) -> J::Out;
2418
2419    /// This function `jsonb_populate_record` takes a Record base and Jsonb as an input and converts it to top-level
2420    /// JSON object to a row having the composite type of the base argument.
2421    ///
2422    /// # Example
2423    ///
2424    /// ```rust
2425    /// # include!("../../doctest_setup.rs");
2426    /// #
2427    /// # fn main() {
2428    /// #     #[cfg(feature = "serde_json")]
2429    /// #     run_test().unwrap();
2430    /// # }
2431    /// #
2432    /// # #[cfg(feature = "serde_json")]
2433    /// # fn run_test() -> QueryResult<()> {
2434    /// #     use diesel::dsl::jsonb_populate_record;
2435    /// #     use diesel::dsl::sql;
2436    /// #     use diesel::sql_types::{Record, Text, Integer, Jsonb};
2437    /// #     use serde_json::Value;
2438    /// #     let connection = &mut establish_connection();
2439    ///
2440    /// let expected: Value = serde_json::json!({
2441    ///     "f1": "Alice",
2442    ///     "f2": 16
2443    /// });
2444    /// let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>(
2445    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2446    ///         expected
2447    /// )).get_result(connection)?;
2448    /// assert_eq!(record, ("Alice".to_string(), 16));
2449    ///
2450    /// let expected: Value = serde_json::json!({});
2451    /// let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>(
2452    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2453    ///         expected
2454    /// )).get_result(connection)?;
2455    /// assert_eq!(record, ("John".to_string(), 30));
2456    ///
2457    /// let expected: Value = serde_json::json!({
2458    ///     "f2": 42,
2459    /// });
2460    /// let record: (String, i32) = diesel::select(jsonb_populate_record::<Record<(Text, Integer)>, Jsonb, _, _>(
2461    ///         sql::<Record<(Text, Integer)>>("ROW('John', 30)"),
2462    ///         expected
2463    /// )).get_result(connection)?;
2464    /// assert_eq!(record, ("John".to_string(), 42));
2465    ///
2466    /// #    Ok(())
2467    /// # }
2468    /// ```
2469    #[sql_name = "jsonb_populate_record"]
2470    #[cfg(feature = "postgres_backend")]
2471    fn jsonb_populate_record<
2472        B: RecordOrNullableRecord + SingleValue,
2473        J: JsonbOrNullableJsonb + CombinedAllNullableValue<Jsonb, B>,
2474    >(
2475        base: B,
2476        from_json: J,
2477    ) -> J::Out;
2478
2479    /// Returns target with the item designated by path replaced by new_value,
2480    ///     or with new_value added and the item designated by path does not exist.
2481    ///
2482    /// It can't set path in scalar
2483    ///
2484    /// All earlier steps in the path must exist, or the target is returned unchanged.
2485    /// As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays.
2486    /// If the last path step is an array index that is out of range,
2487    ///    the new value is added at the beginning of the array if the index is negative,
2488    ///     or at the end of the array if it is positive.
2489    ///
2490    /// # Example
2491    ///
2492    /// ```rust
2493    /// # include!("../../doctest_setup.rs");
2494    /// #
2495    /// # fn main() {
2496    /// #     #[cfg(feature = "serde_json")]
2497    /// #     run_test().unwrap();
2498    /// # }
2499    /// #
2500    /// # #[cfg(feature = "serde_json")]
2501    /// # fn run_test() -> QueryResult<()> {
2502    /// #     use diesel::dsl::jsonb_set;
2503    /// #     use diesel::sql_types::{Jsonb,Array, Json, Nullable, Text};
2504    /// #     use serde_json::{json,Value};
2505    /// #     let connection = &mut establish_connection();
2506    ///
2507    /// let result = diesel::select(jsonb_set::<Jsonb, Array<Text>, _, _, _>(
2508    ///         json!([{"f1":1,"f2":null},2,null,3]),
2509    ///         vec!["0","f1"],
2510    ///         json!([2,3,4])
2511    ///     )).get_result::<Value>(connection)?;
2512    /// let expected: Value = json!([{"f1": [2, 3, 4], "f2": null}, 2, null, 3]);
2513    /// assert_eq!(result, expected);
2514    ///
2515    /// let result = diesel::select(jsonb_set::<Jsonb, Array<Text>, _, _, _>(
2516    ///         json!([{"odd":[2,4,6,8]}]),
2517    ///         // not vec!["odd"], cannot set path in scalar
2518    ///         vec!["0","odd"],
2519    ///         json!([1,3,5,7])
2520    ///     )).get_result::<Value>(connection)?;
2521    /// let expected: Value = json!([{"odd":[1,3,5,7]}]);
2522    /// assert_eq!(result, expected);
2523    ///
2524    /// let empty:Vec<String> = Vec::new();
2525    /// let result = diesel::select(jsonb_set::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _>(
2526    ///         None::<Value>,
2527    ///         empty,
2528    ///         None::<Value>
2529    ///     )).get_result::<Option<Value>>(connection)?;
2530    /// assert!(result.is_none());
2531    ///
2532    /// let empty:Vec<String> = Vec::new();
2533    /// let result = diesel::select(jsonb_set::<Jsonb, Array<Nullable<Text>>, _, _, _>(
2534    ///         // cannot be json!(null)
2535    ///         json!([]),
2536    ///         empty,
2537    ///         json!(null)
2538    ///     )).get_result::<Value>(connection)?;
2539    /// let expected = json!([]);
2540    /// assert_eq!(result, expected);
2541    ///
2542    /// let result = diesel::select(jsonb_set::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _,>(
2543    ///         json!(null),
2544    ///         None::<Vec<String>>,
2545    ///         json!({"foo": 42})
2546    ///     )).get_result::<Option<Value>>(connection)?;
2547    /// assert!(result.is_none());
2548    ///
2549    ///
2550    /// #     Ok(())
2551    /// # }
2552    /// ```
2553    #[cfg(feature = "postgres_backend")]
2554    fn jsonb_set<
2555        E: JsonbOrNullableJsonb + SingleValue,
2556        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
2557    >(
2558        base: E,
2559        path: Arr,
2560        new_value: E,
2561    ) -> Arr::Out;
2562
2563    /// Returns target with the item designated by path replaced by new_value,
2564    ///     or with new_value added if create_if_missing is true (which is the default)
2565    ///     and the item designated by path does not exist.
2566    ///
2567    /// It can't set path in scalar
2568    ///
2569    /// All earlier steps in the path must exist, or the target is returned unchanged.
2570    /// As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays.
2571    /// If the last path step is an array index that is out of range,
2572    ///     and create_if_missing is true, the new value is added at the beginning of the array if the index is negative,
2573    ///     or at the end of the array if it is positive.
2574    ///
2575    /// # Example
2576    ///
2577    /// ```rust
2578    /// # include!("../../doctest_setup.rs");
2579    /// #
2580    /// # fn main() {
2581    /// #     #[cfg(feature = "serde_json")]
2582    /// #     run_test().unwrap();
2583    /// # }
2584    /// #
2585    /// # #[cfg(feature = "serde_json")]
2586    /// # fn run_test() -> QueryResult<()> {
2587    /// #     use diesel::dsl::jsonb_set_create_if_missing;
2588    /// #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};
2589    /// #     use serde_json::{json, Value};
2590    /// #     let connection = &mut establish_connection();
2591    ///
2592    /// let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>(
2593    ///         json!([{"f1":1,"f2":null},2,null,3]),
2594    ///         vec!["0","f1"],
2595    ///         json!([2,3,4]),
2596    ///         true
2597    ///     )).get_result::<Value>(connection)?;
2598    /// let expected: Value = json!([{"f1": [2, 3, 4], "f2": null}, 2, null, 3]);
2599    /// assert_eq!(result, expected);
2600    ///
2601    /// let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>(
2602    ///         json!([{"f1":1,"f2":null},2,null,3]),
2603    ///         vec!["0","f3"],
2604    ///         json!([2,3,4]),
2605    ///         false
2606    ///     )).get_result::<Value>(connection)?;
2607    /// let expected: Value = json!([{"f1":1, "f2": null},2, null, 3]);
2608    /// assert_eq!(result, expected);
2609    ///
2610    /// let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Text>, _, _, _, _>(
2611    ///         json!([{"odd":[2,4,6,8]}]),
2612    ///         // not vec!["odd"], cannot set path in scalar
2613    ///         vec!["0","odd"],
2614    ///         json!([1,3,5,7]),
2615    ///         true
2616    ///     )).get_result::<Value>(connection)?;
2617    /// let expected: Value = json!([{"odd":[1,3,5,7]}]);
2618    /// assert_eq!(result, expected);
2619    ///
2620    /// let empty:Vec<String> = Vec::new();
2621    /// let result = diesel::select(jsonb_set_create_if_missing::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _, _>(
2622    ///         None::<Value>,
2623    ///         empty,
2624    ///         None::<Value>,
2625    ///         true
2626    ///     )).get_result::<Option<Value>>(connection)?;
2627    /// assert!(result.is_none());
2628    ///
2629    /// let empty:Vec<String> = Vec::new();
2630    /// let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Array<Nullable<Text>>, _, _, _, _>(
2631    ///         // cannot be json!(null)
2632    ///         json!([]),
2633    ///         empty,
2634    ///         json!(null),
2635    ///         true
2636    ///     )).get_result::<Value>(connection)?;
2637    /// let expected = json!([]);
2638    /// assert_eq!(result, expected);
2639    ///
2640    /// let result = diesel::select(jsonb_set_create_if_missing::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _, _>(
2641    ///         json!(null),
2642    ///         None::<Vec<String>>,
2643    ///         json!({"foo": 42}),
2644    ///         true
2645    ///     )).get_result::<Option<Value>>(connection)?;
2646    /// assert!(result.is_none());
2647    ///
2648    ///
2649    /// #     Ok(())
2650    /// # }
2651    /// ```
2652    #[sql_name = "jsonb_set"]
2653    fn jsonb_set_create_if_missing<
2654        E: JsonbOrNullableJsonb + SingleValue,
2655        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
2656    >(
2657        base: E,
2658        path: Arr,
2659        new_value: E,
2660        create_if_missing: Bool,
2661    ) -> Arr::Out;
2662
2663    /// Returns target with the item designated by path replaced by new_value,
2664    ///     or with new_value added and the item designated by path does not exist.
2665    ///
2666    /// It can't set path in scalar
2667    ///
2668    /// All earlier steps in the path must exist, or the target is returned unchanged.
2669    /// As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays.
2670    /// If the last path step is an array index that is out of range,
2671    ///    the new value is added at the beginning of the array if the index is negative,
2672    ///     or at the end of the array if it is positive.
2673    ///
2674    /// If new_value is not NULL, behaves identically to jsonb_set.
2675    ///    Otherwise behaves according to the value of null_value_treatment
2676    ///    which must be one of 'raise_exception', 'use_json_null', 'delete_key', or 'return_target'.
2677    ///    The default is 'use_json_null'.
2678    ///
2679    /// # Example
2680    ///
2681    /// ```rust
2682    /// # include!("../../doctest_setup.rs");
2683    /// #
2684    /// # fn main() {
2685    /// #     #[cfg(feature = "serde_json")]
2686    /// #     run_test().unwrap();
2687    /// # }
2688    /// #
2689    /// # #[cfg(feature = "serde_json")]
2690    /// # fn run_test() -> QueryResult<()> {
2691    /// #     use diesel::dsl::jsonb_set_lax;
2692    /// #     use diesel::sql_types::{Jsonb,Array,NullValueTreatment, Json, Nullable, Text};
2693    /// #     use serde_json::{json,Value};
2694    /// #     let connection = &mut establish_connection();
2695    ///
2696    /// let null_value_treatment = NullValueTreatment::UseJsonNull;
2697    /// let result = diesel::select(jsonb_set_lax::<Jsonb, Array<Text>, _, _, _, _, _>(
2698    ///         json!([{"f1":1,"f2":null},2,null,3]),
2699    ///         vec!["0","f1"],
2700    ///         json!([2,3,4]),
2701    ///         true,
2702    ///         null_value_treatment
2703    ///     )).get_result::<Value>(connection)?;
2704    /// let expected: Value = json!([{"f1": [2, 3, 4], "f2": null}, 2, null, 3]);
2705    /// assert_eq!(result, expected);
2706    ///
2707    /// let null_value_treatment = NullValueTreatment::ReturnTarget;
2708    /// let result = diesel::select(jsonb_set_lax::<Nullable<Jsonb>, Array<Nullable<Text>>, _, _, _, _, _>(
2709    ///         json!([{"f1":99,"f2":null},2]),
2710    ///         vec!["0","f3"],
2711    ///         None::<Value>,
2712    ///         true,
2713    ///         null_value_treatment
2714    ///     )).get_result::<Option<Value>>(connection)?;
2715    /// assert_eq!(result, Some(json!([{"f1":99,"f2":null},2])));
2716    ///
2717    /// let null_value_treatment = NullValueTreatment::UseJsonNull;
2718    /// let empty:Vec<String> = Vec::new();
2719    /// let result = diesel::select(jsonb_set_lax::<Jsonb, Array<Nullable<Text>>, _, _, _, _, _>(
2720    ///         // cannot be json!(null)
2721    ///         json!([]),
2722    ///         empty,
2723    ///         json!(null),
2724    ///         true,
2725    ///         null_value_treatment
2726    ///     )).get_result::<Value>(connection)?;
2727    /// let expected = json!([]);
2728    /// assert_eq!(result, expected);
2729    ///
2730    /// let null_value_treatment = NullValueTreatment::UseJsonNull;
2731    /// let result = diesel::select(jsonb_set_lax::<Jsonb, Nullable<Array<Nullable<Text>>>, _, _, _, _, _,>(
2732    ///         json!(null),
2733    ///         None::<Vec<String>>,
2734    ///         json!({"foo": 42}),
2735    ///         true,
2736    ///         null_value_treatment
2737    ///     )).get_result::<Option<Value>>(connection)?;
2738    /// assert!(result.is_none());
2739    ///
2740    /// #     Ok(())
2741    /// # }
2742    /// ```
2743    fn jsonb_set_lax<
2744        E: JsonbOrNullableJsonb + SingleValue,
2745        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
2746    >(
2747        base: E,
2748        path: Arr,
2749        new_value: E,
2750        create_if_missing: Bool,
2751        null_value_treatment: NullValueTreatmentEnum,
2752    ) -> Arr::Out;
2753
2754    /// Returns target with `new_value` inserted into `base`.
2755    ///
2756    /// If the item designated by the `path` is an array element, `new_value` will be inserted before that item
2757    ///
2758    /// If the item designated by the `path` is an object field, `new_value` will be
2759    /// inserted only if the object does not already contain that key.
2760    ///
2761    /// * All earlier steps in the path must exist, or the target is returned unchanged.
2762    /// * As with the path oriented operators, negative integers that appear in the `path` count
2763    ///   from the end of JSON arrays.
2764    /// * If the last `path` step is an array index that is out of range,
2765    ///   the new value is added at the beginning of the array if the index is negative,
2766    ///   or at the end of the array if it is positive.
2767    ///
2768    /// # Example
2769    ///
2770    /// ```rust
2771    /// # include!("../../doctest_setup.rs");
2772    /// #
2773    /// # fn main() {
2774    /// #     #[cfg(feature = "serde_json")]
2775    /// #     run_test().unwrap();
2776    /// # }
2777    /// #
2778    /// # #[cfg(feature = "serde_json")]
2779    /// # fn run_test() -> QueryResult<()> {
2780    /// #     use diesel::dsl::jsonb_insert;
2781    /// #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};
2782    /// #     use serde_json::{json,Value};
2783    /// #     let connection = &mut establish_connection();
2784    ///
2785    /// let result = diesel::select(jsonb_insert::<Jsonb, Array<Text>, _, _, _>(
2786    ///         json!({"a":[0,1,2]}),
2787    ///         vec!["a","1"],
2788    ///         json!("new_value"),
2789    ///     )).get_result::<Value>(connection)?;
2790    /// let expected: Value = json!({"a":[0,"new_value",1,2]});
2791    /// assert_eq!(result, expected);
2792    ///
2793    /// let result = diesel::select(jsonb_insert::<Nullable<Jsonb>, Array<Text>, _, _, _>(
2794    ///         None::<serde_json::Value>,
2795    ///         vec!["a","1"],
2796    ///         Some(json!("new_value")),
2797    ///     )).get_result::<Option<Value>>(connection)?;
2798    /// assert_eq!(result, None);
2799    ///
2800    /// #     Ok(())
2801    /// # }
2802    /// ```
2803    fn jsonb_insert<
2804        E: JsonbOrNullableJsonb + SingleValue,
2805        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
2806    >(
2807        base: E,
2808        path: Arr,
2809        new_value: E,
2810    ) -> Arr::Out;
2811
2812    /// Returns target with `new_value` inserted into `base`.
2813    ///
2814    /// If the item designated by the `path` is an array element, `new_value` will be inserted before that
2815    /// item if `insert_after` is false (which is the default),
2816    /// or after it if `insert_after` is true.
2817    ///
2818    /// If the item designated by the `path` is an object field, `new_value` will be inserted only
2819    /// if the object does not already contain that key.
2820    ///
2821    /// * All earlier steps in the `path` must exist, or the target is returned unchanged.
2822    /// * As with the path oriented operators, negative integers that appear in the `path` count
2823    ///   from the end of JSON arrays.
2824    /// * If the last `path` step is an array index that is out of range,
2825    ///   the new value is added at the beginning of the array if the index is negative,
2826    ///   or at the end of the array if it is positive.
2827    ///
2828    /// # Example
2829    ///
2830    /// ```rust
2831    /// # include!("../../doctest_setup.rs");
2832    /// #
2833    /// # fn main() {
2834    /// #     #[cfg(feature = "serde_json")]
2835    /// #     run_test().unwrap();
2836    /// # }
2837    /// #
2838    /// # #[cfg(feature = "serde_json")]
2839    /// # fn run_test() -> QueryResult<()> {
2840    /// #     use diesel::dsl::jsonb_insert_with_insert_after;
2841    /// #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text};
2842    /// #     use serde_json::{json,Value};
2843    /// #     let connection = &mut establish_connection();
2844    ///
2845    /// let result = diesel::select(jsonb_insert_with_insert_after::<Jsonb, Array<Text>, _, _, _, _>(
2846    ///         json!({"a":[0,1,2]}),
2847    ///         vec!["a","1"],
2848    ///         json!("new_value"),
2849    ///         false
2850    ///     )).get_result::<Value>(connection)?;
2851    /// let expected: Value = json!({"a":[0,"new_value",1,2]});
2852    /// assert_eq!(result, expected);
2853    ///
2854    /// let result = diesel::select(jsonb_insert_with_insert_after::<Jsonb, Array<Text>, _, _, _, _>(
2855    ///         json!({"a":[0,1,2]}),
2856    ///         vec!["a","1"],
2857    ///         json!("new_value"),
2858    ///         true
2859    ///     )).get_result::<Value>(connection)?;
2860    /// let expected: Value = json!({"a":[0,1,"new_value",2,]});
2861    /// assert_eq!(result, expected);
2862    ///
2863    /// #     Ok(())
2864    /// # }
2865    /// ```
2866    #[sql_name = "jsonb_insert"]
2867    fn jsonb_insert_with_insert_after<
2868        E: JsonbOrNullableJsonb + SingleValue,
2869        Arr: TextArrayOrNullableTextArray + CombinedNullableValue<E, Jsonb>,
2870    >(
2871        base: E,
2872        path: Arr,
2873        new_value: E,
2874        insert_after: Bool,
2875    ) -> Arr::Out;
2876
2877    /// Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_json.
2878    ///
2879    ///
2880    /// # Example
2881    ///
2882    /// ```rust
2883    /// # include!("../../doctest_setup.rs");
2884    /// #
2885    /// # fn main() {
2886    /// #     #[cfg(feature = "serde_json")]
2887    /// #     run_test().unwrap();
2888    /// # }
2889    /// #
2890    /// # #[cfg(feature = "serde_json")]
2891    /// # fn run_test() -> QueryResult<()> {
2892    /// #     use diesel::dsl::{json_build_array_1, json_build_array_2, json_build_array_0};
2893    /// #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};
2894    /// #     use serde_json::{json,Value};
2895    /// #     use diesel::dsl::sql;
2896    /// #     let connection = &mut establish_connection();
2897    ///
2898    /// let result = diesel::select(json_build_array_0()).get_result::<serde_json::Value>(connection)?;
2899    /// assert_eq!(json!([]), result);
2900    ///
2901    /// let result = diesel::select(json_build_array_1::<Text, _>("abc"))
2902    ///     .get_result::<serde_json::Value>(connection)?;
2903    /// assert_eq!(json!(["abc"]), result);
2904    ///
2905    /// let result = diesel::select(json_build_array_2::<Text, Double, _, _>("abc", 3.1415))
2906    ///     .get_result::<serde_json::Value>(connection)?;
2907    /// assert_eq!(json!(["abc", 3.1415]), result);
2908    ///
2909    /// let result = diesel::select(json_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>("ROW('abc',3.1415)")))
2910    ///     .get_result::<serde_json::Value>(connection)?;
2911    /// assert_eq!(json!([
2912    ///     {
2913    ///         "f1":"abc",
2914    ///         "f2":3.1415
2915    ///     }
2916    ///  ]), result);
2917    ///
2918    /// let result = diesel::select(json_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))
2919    ///     .get_result::<serde_json::Value>(connection)?;
2920    /// assert_eq!(json!([ [1, 2, 3] ]), result);
2921    ///
2922    /// let result = diesel::select(json_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))
2923    ///     .get_result::<serde_json::Value>(connection)?;
2924    /// assert_eq!(json!([None::<String>, 3.1415]), result);
2925    ///
2926    /// let result = diesel::select(json_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>("ROW(null,3.1415)")))
2927    ///     .get_result::<serde_json::Value>(connection)?;
2928    ///
2929    /// assert_eq!(json!([
2930    ///     {
2931    ///         "f1":None::<String>,
2932    ///         "f2":3.1415
2933    ///     }
2934    ///  ]), result);
2935    ///
2936    /// #     Ok(())
2937    /// # }
2938    /// ```
2939    #[cfg(feature = "postgres_backend")]
2940    #[sql_name = "json_build_array"]
2941    #[variadic(1)]
2942    fn json_build_array<V: SingleValue>(value: V) -> Json;
2943
2944    /// Builds a possibly-heterogeneously-typed JSON array out of a variadic argument list. Each argument is converted as per to_jsonb.
2945    ///
2946    ///
2947    /// # Example
2948    ///
2949    /// ```rust
2950    /// # include!("../../doctest_setup.rs");
2951    /// #
2952    /// # fn main() {
2953    /// #     #[cfg(feature = "serde_json")]
2954    /// #     run_test().unwrap();
2955    /// # }
2956    /// #
2957    /// # #[cfg(feature = "serde_json")]
2958    /// # fn run_test() -> QueryResult<()> {
2959    /// #     use diesel::dsl::{jsonb_build_array_1, jsonb_build_array_2, jsonb_build_array_0};
2960    /// #     use diesel::sql_types::{Jsonb, Array, Json, Nullable, Text, Integer, Record, Double};
2961    /// #     use serde_json::{json,Value};
2962    /// #     use diesel::dsl::sql;
2963    /// #     let connection = &mut establish_connection();
2964    ///
2965    /// let result = diesel::select(jsonb_build_array_0()).get_result::<serde_json::Value>(connection)?;
2966    /// assert_eq!(json!([]), result);
2967    ///
2968    /// let result = diesel::select(jsonb_build_array_1::<Text, _>("abc"))
2969    ///     .get_result::<serde_json::Value>(connection)?;
2970    /// assert_eq!(json!(["abc"]), result);
2971    ///
2972    /// let result = diesel::select(jsonb_build_array_2::<Text, Double, _, _>("abc", 3.1415))
2973    ///     .get_result::<serde_json::Value>(connection)?;
2974    /// assert_eq!(json!(["abc", 3.1415]), result);
2975    ///
2976    /// let result = diesel::select(jsonb_build_array_1::<Record<(Text, Double)>, _>(sql::<Record<(Text, Double)>>("ROW('abc',3.1415)")))
2977    ///     .get_result::<serde_json::Value>(connection)?;
2978    /// assert_eq!(json!([
2979    ///     {
2980    ///         "f1":"abc",
2981    ///         "f2":3.1415
2982    ///     }
2983    ///  ]), result);
2984    ///
2985    /// let result = diesel::select(jsonb_build_array_1::<Array<Integer>, _>(vec![1, 2, 3]))
2986    ///     .get_result::<serde_json::Value>(connection)?;
2987    /// assert_eq!(json!([ [1, 2, 3] ]), result);
2988    ///
2989    /// let result = diesel::select(jsonb_build_array_2::<Nullable<Text>, Double, _, _>(None::<String>, 3.1415))
2990    ///     .get_result::<serde_json::Value>(connection)?;
2991    /// assert_eq!(json!([None::<String>, 3.1415]), result);
2992    ///
2993    /// let result = diesel::select(jsonb_build_array_1::<Record<(Nullable<Text>, Double)>, _>(sql::<Record<(Nullable<Text>, Double)>>("ROW(null,3.1415)")))
2994    ///     .get_result::<serde_json::Value>(connection)?;
2995    ///
2996    /// assert_eq!(json!([
2997    ///     {
2998    ///         "f1":None::<String>,
2999    ///         "f2":3.1415
3000    ///     }
3001    ///  ]), result);
3002    ///
3003    /// #     Ok(())
3004    /// # }
3005    /// ```
3006    #[cfg(feature = "postgres_backend")]
3007    #[sql_name = "jsonb_build_array"]
3008    #[variadic(1)]
3009    fn jsonb_build_array<V: SingleValue>(value: V) -> Jsonb;
3010    /// Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)
3011    ///
3012    /// # Example
3013    ///
3014    /// ```rust
3015    /// # include!("../../doctest_setup.rs");
3016    /// #
3017    /// # fn main() {
3018    /// #     #[cfg(feature = "serde_json")]
3019    /// #     run_test().unwrap();
3020    /// # }
3021    /// #
3022    /// # #[cfg(feature = "serde_json")]
3023    /// # fn run_test() -> QueryResult<()> {
3024    /// #     use diesel::dsl::{json_extract_path_1, json_extract_path_2};
3025    /// #     use diesel::sql_types::{Json, Nullable, Text};
3026    /// #     use serde_json::{json,Value};
3027    /// #     use diesel::dsl::sql;
3028    /// #     let connection = &mut establish_connection();
3029    ///
3030    /// let expected = Some(json!({"f5":99, "f6":"foo"}));
3031    /// let result = diesel::select(json_extract_path_1::<Json, Text, _, _>(
3032    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3033    ///     "f4",
3034    /// ))
3035    /// .get_result::<Option<serde_json::Value>>(connection)?;
3036    ///
3037    /// assert_eq!(expected, result);
3038    ///
3039    /// let expected = Some(json!("foo"));
3040    /// let result = diesel::select(json_extract_path_2::<Json, Text, Text, _, _, _>(
3041    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3042    ///     "f4",
3043    ///     "f6"
3044    /// ))
3045    /// .get_result::<Option<serde_json::Value>>(connection)?;
3046    ///
3047    /// assert_eq!(expected, result);
3048    ///
3049    /// let result = diesel::select(json_extract_path_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, "f4"))
3050    /// .get_result::<Option<serde_json::Value>>(connection)?;
3051    ///
3052    /// assert_eq!(None::<serde_json::Value>, result);
3053    ///
3054    /// let result = diesel::select(json_extract_path_2::<Json, Nullable<Text>, Text, _, _, _>(json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}), None::<String>, "f6"))
3055    /// .get_result::<Option<serde_json::Value>>(connection)?;
3056    ///
3057    ///
3058    /// assert_eq!(None::<serde_json::Value>, result);
3059    ///
3060    /// #     Ok(())
3061    /// # }
3062    /// ```
3063    #[cfg(feature = "postgres_backend")]
3064    #[sql_name = "json_extract_path"]
3065    #[variadic(last_arguments = 1, skip_zero_argument_variant = true)]
3066    fn json_extract_path<J: JsonOrNullableJson + SingleValue, T: SingleValue>(
3067        json: J,
3068        text: T,
3069    ) -> Nullable<Json>;
3070
3071    /// Extracts JSON sub-object at the specified path. (This is functionally equivalent to the #> operator, but writing the path out as a variadic list can be more convenient in some cases.)
3072    ///
3073    /// # Example
3074    ///
3075    /// ```rust
3076    /// # include!("../../doctest_setup.rs");
3077    /// #
3078    /// # fn main() {
3079    /// #     #[cfg(feature = "serde_json")]
3080    /// #     run_test().unwrap();
3081    /// # }
3082    /// #
3083    /// # #[cfg(feature = "serde_json")]
3084    /// # fn run_test() -> QueryResult<()> {
3085    /// #     use diesel::dsl::{jsonb_extract_path_1, jsonb_extract_path_2};
3086    /// #     use diesel::sql_types::{Jsonb, Nullable, Text};
3087    /// #     use serde_json::{json,Value};
3088    /// #     use diesel::dsl::sql;
3089    /// #     let connection = &mut establish_connection();
3090    ///
3091    /// let expected = Some(json!({"f5":99, "f6":"foo"}));
3092    /// let result = diesel::select(jsonb_extract_path_1::<Jsonb, Text, _, _>(
3093    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3094    ///     "f4",
3095    /// ))
3096    /// .get_result::<Option<serde_json::Value>>(connection)?;
3097    ///
3098    /// assert_eq!(expected, result);
3099    ///
3100    /// let expected = Some(json!("foo"));
3101    /// let result = diesel::select(jsonb_extract_path_2::<Jsonb, Text, Text, _, _, _>(
3102    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3103    ///     "f4",
3104    ///     "f6"
3105    /// ))
3106    /// .get_result::<Option<serde_json::Value>>(connection)?;
3107    ///
3108    /// assert_eq!(expected, result);
3109    ///
3110    /// let result = diesel::select(jsonb_extract_path_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, "f4"))
3111    /// .get_result::<Option<serde_json::Value>>(connection)?;
3112    ///
3113    /// assert_eq!(None::<serde_json::Value>, result);
3114    ///
3115    /// let result = diesel::select(jsonb_extract_path_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}), None::<String>, "f6"))
3116    /// .get_result::<Option<serde_json::Value>>(connection)?;
3117    ///
3118    ///
3119    /// assert_eq!(None::<serde_json::Value>, result);
3120    ///
3121    /// #     Ok(())
3122    /// # }
3123    /// ```
3124    #[cfg(feature = "postgres_backend")]
3125    #[sql_name = "jsonb_extract_path"]
3126    #[variadic(last_arguments = 1, skip_zero_argument_variant = true)]
3127    fn jsonb_extract_path<J: JsonbOrNullableJsonb + SingleValue, T: SingleValue>(
3128        json: J,
3129        text: T,
3130    ) -> Nullable<Jsonb>;
3131
3132    /// Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)
3133    ///
3134    /// # Example
3135    ///
3136    /// ```rust
3137    /// # include!("../../doctest_setup.rs");
3138    /// #
3139    /// # fn main() {
3140    /// #     #[cfg(feature = "serde_json")]
3141    /// #     run_test().unwrap();
3142    /// # }
3143    /// #
3144    /// # #[cfg(feature = "serde_json")]
3145    /// # fn run_test() -> QueryResult<()> {
3146    /// #     use diesel::dsl::{json_extract_path_text_1, json_extract_path_text_2};
3147    /// #     use diesel::sql_types::{Json, Nullable, Text};
3148    /// #     use serde_json::{json,Value};
3149    /// #     use diesel::dsl::sql;
3150    /// #     let connection = &mut establish_connection();
3151    ///
3152    /// let expected = Some(String::from("{\"f5\":99,\"f6\":\"foo\"}"));
3153    /// let result = diesel::select(json_extract_path_text_1::<Json, Text, _, _>(
3154    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3155    ///     "f4",
3156    /// ))
3157    /// .get_result::<Option<String>>(connection)?;
3158    ///
3159    /// assert_eq!(expected, result);
3160    ///
3161    /// let expected = Some(String::from("foo"));
3162    /// let result = diesel::select(json_extract_path_text_2::<Json, Text, Text, _, _, _>(
3163    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3164    ///     "f4",
3165    ///     "f6"
3166    /// ))
3167    /// .get_result::<Option<String>>(connection)?;
3168    ///
3169    /// assert_eq!(expected, result);
3170    ///
3171    /// let result = diesel::select(json_extract_path_text_1::<Nullable<Json>, Text, _, _>(None::<serde_json::Value>, "f4"))
3172    /// .get_result::<Option<String>>(connection)?;
3173    ///
3174    /// assert_eq!(None::<String>, result);
3175    ///
3176    /// let result = diesel::select(json_extract_path_text_2::<Json, Nullable<Text>, Text, _, _, _>(json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}), None::<String>, "f6"))
3177    /// .get_result::<Option<String>>(connection)?;
3178    ///
3179    /// assert_eq!(None::<String>, result);
3180    ///
3181    /// #     Ok(())
3182    /// # }
3183    /// ```
3184    #[cfg(feature = "postgres_backend")]
3185    #[sql_name = "json_extract_path_text"]
3186    #[variadic(last_arguments = 1, skip_zero_argument_variant = true)]
3187    fn json_extract_path_text<
3188        J: JsonOrNullableJson + SingleValue,
3189        T: SingleValue + TextOrNullableText,
3190    >(
3191        json: J,
3192        text: T,
3193    ) -> Nullable<Text>;
3194
3195    /// Extracts JSON sub-object at the specified path as text. (This is functionally equivalent to the #>> operator.)
3196    ///
3197    /// # Example
3198    ///
3199    /// ```rust
3200    /// # include!("../../doctest_setup.rs");
3201    /// #
3202    /// # fn main() {
3203    /// #     #[cfg(feature = "serde_json")]
3204    /// #     run_test().unwrap();
3205    /// # }
3206    /// #
3207    /// # #[cfg(feature = "serde_json")]
3208    /// # fn run_test() -> QueryResult<()> {
3209    /// #     use diesel::dsl::{jsonb_extract_path_text_1, jsonb_extract_path_text_2};
3210    /// #     use diesel::sql_types::{Jsonb, Nullable, Text};
3211    /// #     use serde_json::{json,Value};
3212    /// #     use diesel::dsl::sql;
3213    /// #     let connection = &mut establish_connection();
3214    ///
3215    /// let expected = Some(String::from("{\"f5\": 99, \"f6\": \"foo\"}"));
3216    /// let result = diesel::select(jsonb_extract_path_text_1::<Jsonb, Text, _, _>(
3217    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3218    ///     "f4",
3219    /// ))
3220    /// .get_result::<Option<String>>(connection)?;
3221    ///
3222    /// assert_eq!(expected, result);
3223    ///
3224    /// let expected = Some(String::from("foo"));
3225    /// let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Text, Text, _, _, _>(
3226    ///     json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}),
3227    ///     "f4",
3228    ///     "f6"
3229    /// ))
3230    /// .get_result::<Option<String>>(connection)?;
3231    ///
3232    /// assert_eq!(expected, result);
3233    ///
3234    /// let result = diesel::select(jsonb_extract_path_text_1::<Nullable<Jsonb>, Text, _, _>(None::<serde_json::Value>, "f4"))
3235    /// .get_result::<Option<String>>(connection)?;
3236    ///
3237    /// assert_eq!(None::<String>, result);
3238    ///
3239    /// let result = diesel::select(jsonb_extract_path_text_2::<Jsonb, Nullable<Text>, Text, _, _, _>(json!({"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}), None::<String>, "f6"))
3240    /// .get_result::<Option<String>>(connection)?;
3241    ///
3242    /// assert_eq!(None::<String>, result);
3243    ///
3244    /// #     Ok(())
3245    /// # }
3246    /// ```
3247    #[cfg(feature = "postgres_backend")]
3248    #[sql_name = "jsonb_extract_path_text"]
3249    #[variadic(last_arguments = 1, skip_zero_argument_variant = true)]
3250    fn jsonb_extract_path_text<
3251        J: JsonbOrNullableJsonb + SingleValue,
3252        T: SingleValue + TextOrNullableText,
3253    >(
3254        json: J,
3255        text: T,
3256    ) -> Nullable<Text>;
3257}
3258
3259pub(super) mod return_type_helpers_reexported {
3260    #[allow(unused_imports)]
3261    #[doc(inline)]
3262    pub use super::return_type_helpers::*;
3263}