Skip to main content

diesel/pg/types/
mod.rs

1//! PostgreSQL specific types
2
3#[doc(hidden)]
4pub(in crate::pg) mod array;
5#[doc(hidden)]
6pub(in crate::pg) mod date_and_time;
7#[doc(hidden)]
8pub(in crate::pg) mod floats;
9mod integers;
10#[cfg(feature = "ipnet-address")]
11mod ipnet_address;
12#[cfg(feature = "serde_json")]
13mod json;
14mod json_function_enum;
15mod mac_addr;
16mod mac_addr_8;
17#[doc(hidden)]
18pub(in crate::pg) mod money;
19mod multirange;
20#[cfg(feature = "network-address")]
21mod network_address;
22mod numeric;
23pub(in crate::pg) mod pg_lsn;
24mod primitives;
25mod ranges;
26mod record;
27#[cfg(feature = "uuid")]
28mod uuid;
29
30/// PostgreSQL specific SQL types
31///
32/// Note: All types in this module can be accessed through `diesel::sql_types`
33pub mod sql_types {
34    use crate::query_builder::QueryId;
35    use crate::sql_types::SqlType;
36
37    /// The [`OID`] SQL type. This is a PostgreSQL specific type.
38    ///
39    /// ### [`ToSql`] impls
40    ///
41    /// - [`u32`]
42    ///
43    /// ### [`FromSql`] impls
44    ///
45    /// - [`u32`]
46    ///
47    /// [`ToSql`]: crate::serialize::ToSql
48    /// [`FromSql`]: crate::deserialize::FromSql
49    /// [`u32`]: https://doc.rust-lang.org/nightly/std/primitive.u32.html
50    /// [`OID`]: https://www.postgresql.org/docs/current/datatype-oid.html
51    #[cfg(feature = "postgres_backend")]
52    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Oid {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Oid")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Oid {
    #[inline]
    fn clone(&self) -> Oid { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Oid { }Copy, #[automatically_derived]
impl ::core::default::Default for Oid {
    #[inline]
    fn default() -> Oid { Oid {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Oid {
            type QueryId = Oid<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Oid {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Oid {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Oid> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(26, 1028)
            }
        }
    };SqlType)]
53    #[diesel(postgres_type(oid = 26, array_oid = 1028))]
54    pub struct Oid;
55
56    /// The ["timestamp with time zone" SQL type][tz], which PostgreSQL abbreviates
57    /// to `timestamptz`.
58    ///
59    /// ### [`ToSql`] impls
60    ///
61    /// - [`PgTimestamp`]
62    /// - [`chrono::NaiveDateTime`] with `feature = "chrono"`
63    /// - [`chrono::DateTime`] with `feature = "chrono"`
64    /// - [`time::PrimitiveDateTime`] with `feature = "time"`
65    /// - [`time::OffsetDateTime`] with `feature = "time"`
66    ///
67    /// ### [`FromSql`] impls
68    ///
69    /// - [`PgTimestamp`]
70    /// - [`chrono::NaiveDateTime`] with `feature = "chrono"`
71    /// - [`chrono::DateTime`] with `feature = "chrono"`
72    /// - [`time::PrimitiveDateTime`] with `feature = "time"`
73    /// - [`time::OffsetDateTime`] with `feature = "time"`
74    ///
75    /// [`ToSql`]: crate::serialize::ToSql
76    /// [`FromSql`]: crate::deserialize::FromSql
77    /// [`PgTimestamp`]: super::super::data_types::PgTimestamp
78    /// [tz]: https://www.postgresql.org/docs/current/datatype-datetime.html
79    #[cfg_attr(
80        feature = "chrono",
81        doc = " [`chrono::NaiveDateTime`]: chrono::naive::NaiveDateTime"
82    )]
83    #[cfg_attr(
84        not(feature = "chrono"),
85        doc = " [`chrono::NaiveDateTime`]: https://docs.rs/chrono/0.4.19/chrono/naive/struct.NaiveDateTime.html"
86    )]
87    #[cfg_attr(feature = "chrono", doc = " [`chrono::DateTime`]: chrono::DateTime")]
88    #[cfg_attr(
89        not(feature = "chrono"),
90        doc = " [`chrono::DateTime`]: https://docs.rs/chrono/0.4.19/chrono/struct.DateTime.html"
91    )]
92    #[cfg_attr(
93        feature = "time",
94        doc = " [`time::PrimitiveDateTime`]: time::PrimitiveDateTime"
95    )]
96    #[cfg_attr(
97        not(feature = "time"),
98        doc = " [`time::PrimitiveDateTime`]: https://docs.rs/time/0.3.9/time/struct.PrimitiveDateTime.html"
99    )]
100    #[cfg_attr(
101        feature = "time",
102        doc = " [`time::OffsetDateTime`]: time::OffsetDateTime"
103    )]
104    #[cfg_attr(
105        not(feature = "time"),
106        doc = " [`time::OffsetDateTime`]: https://docs.rs/time/0.3.9/time/struct.OffsetDateTime.html"
107    )]
108    #[cfg(feature = "postgres_backend")]
109    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Timestamptz {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Timestamptz")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Timestamptz {
    #[inline]
    fn clone(&self) -> Timestamptz { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Timestamptz { }Copy, #[automatically_derived]
impl ::core::default::Default for Timestamptz {
    #[inline]
    fn default() -> Timestamptz { Timestamptz {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Timestamptz {
            type QueryId = Timestamptz<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Timestamptz {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Timestamptz {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Timestamptz> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(1184, 1185)
            }
        }
    };SqlType)]
110    #[diesel(postgres_type(oid = 1184, array_oid = 1185))]
111    pub struct Timestamptz;
112
113    /// The [`Array`] SQL type.
114    ///
115    /// This wraps another type to represent a SQL array of that type.
116    /// Multidimensional arrays are not supported.
117    ///
118    /// ### [`ToSql`] impls
119    ///
120    /// - [`Vec<T>`][Vec] for any `T` which implements `ToSql<ST>`
121    /// - [`&[T]`][slice] for any `T` which implements `ToSql<ST>`
122    ///
123    /// ### [`FromSql`] impls
124    ///
125    /// - [`Vec<T>`][Vec] for any `T` which implements `ToSql<ST>`
126    ///
127    /// [`ToSql`]: crate::serialize::ToSql
128    /// [`FromSql`]: crate::deserialize::FromSql
129    /// [Vec]: std::vec::Vec
130    /// [slice]: https://doc.rust-lang.org/nightly/std/primitive.slice.html
131    /// [`Array`]: https://www.postgresql.org/docs/current/arrays.html
132    #[derive(#[automatically_derived]
impl<ST: ::core::fmt::Debug + 'static> ::core::fmt::Debug for Array<ST> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl<ST: ::core::clone::Clone + 'static> ::core::clone::Clone for Array<ST> {
    #[inline]
    fn clone(&self) -> Array<ST> {
        Array(::core::clone::Clone::clone(&self.0))
    }
}Clone, #[automatically_derived]
impl<ST: ::core::marker::Copy + 'static> ::core::marker::Copy for Array<ST> {
}Copy, #[automatically_derived]
impl<ST: ::core::default::Default + 'static> ::core::default::Default for
    Array<ST> {
    #[inline]
    fn default() -> Array<ST> { Array(::core::default::Default::default()) }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<ST: 'static + diesel::query_builder::QueryId>
            diesel::query_builder::QueryId for Array<ST> {
            type QueryId =
                Array<<ST as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <ST as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                    true;
            const IS_WINDOW_FUNCTION: bool =
                <ST as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl<ST: 'static> diesel::sql_types::SqlType for Array<ST> {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = true;
        }
        impl<ST: 'static> diesel::sql_types::SingleValue for Array<ST> {}
    };SqlType)]
133    #[cfg(feature = "postgres_backend")]
134    pub struct Array<ST: 'static>(ST);
135
136    /// The [`Range`] SQL type.
137    ///
138    /// This wraps another type to represent a SQL range of that type.
139    ///
140    /// ### [`ToSql`] impls
141    ///
142    /// - [`(Bound<T>, Bound<T>)`][bound] for any `T` which implements `ToSql<ST>`.
143    /// - [`Range<T>`][std::range] (aka `start..end`) for any `T` which implements `ToSql<ST>`.
144    /// - [`RangeInclusive<T>`] (aka `start..=end`) for any `T` which implements `ToSql<ST>`.
145    /// - [`RangeFrom<T>`] (aka `start..`) for any `T` which implements `ToSql<ST>`.
146    /// - [`RangeTo<T>`] (aka `..end`) for any `T` which implements `ToSql<ST>`.
147    /// - [`RangeToInclusive<T>`] (aka `..=end`) for any `T` which implements `ToSql<ST>`.
148    ///
149    /// ### [`FromSql`] impls
150    ///
151    /// - [`(Bound<T>, Bound<T>)`][bound] for any `T` which implements `FromSql<ST>`.
152    ///
153    /// [`ToSql`]: crate::serialize::ToSql
154    /// [`FromSql`]: crate::deserialize::FromSql
155    /// [bound]: std::collections::Bound
156    /// [std::range]: std::ops::Range
157    /// [`RangeInclusive<T>`]: std::ops::RangeInclusive
158    /// [`RangeFrom<T>`]: std::ops::RangeFrom
159    /// [`RangeTo<T>`]: std::ops::RangeTo
160    /// [`RangeToInclusive<T>`]: std::ops::RangeToInclusive
161    /// [`Range`]: https://www.postgresql.org/docs/current/rangetypes.html
162    #[derive(#[automatically_derived]
impl<ST: ::core::fmt::Debug + 'static> ::core::fmt::Debug for Range<ST> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Range",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl<ST: ::core::clone::Clone + 'static> ::core::clone::Clone for Range<ST> {
    #[inline]
    fn clone(&self) -> Range<ST> {
        Range(::core::clone::Clone::clone(&self.0))
    }
}Clone, #[automatically_derived]
impl<ST: ::core::marker::Copy + 'static> ::core::marker::Copy for Range<ST> {
}Copy, #[automatically_derived]
impl<ST: ::core::default::Default + 'static> ::core::default::Default for
    Range<ST> {
    #[inline]
    fn default() -> Range<ST> { Range(::core::default::Default::default()) }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<ST: 'static + diesel::query_builder::QueryId>
            diesel::query_builder::QueryId for Range<ST> {
            type QueryId =
                Range<<ST as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <ST as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                    true;
            const IS_WINDOW_FUNCTION: bool =
                <ST as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl<ST: 'static> diesel::sql_types::SqlType for Range<ST> {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl<ST: 'static> diesel::sql_types::SingleValue for Range<ST> {}
    };SqlType)]
163    #[cfg(feature = "postgres_backend")]
164    pub struct Range<ST: 'static>(ST);
165
166    #[doc(hidden)]
167    pub type Int4range = Range<crate::sql_types::Int4>;
168    #[doc(hidden)]
169    pub type Int8range = Range<crate::sql_types::Int8>;
170    #[doc(hidden)]
171    pub type Daterange = Range<crate::sql_types::Date>;
172    #[doc(hidden)]
173    pub type Numrange = Range<crate::sql_types::Numeric>;
174    #[doc(hidden)]
175    pub type Tsrange = Range<crate::sql_types::Timestamp>;
176    #[doc(hidden)]
177    pub type Tstzrange = Range<crate::sql_types::Timestamptz>;
178
179    /// The [`Multirange`] SQL type.
180    ///
181    /// This wraps another type to represent a SQL range of that type.
182    ///
183    /// ### [`ToSql`] impls
184    ///
185    /// - [`Vec<T>`][Vec] for any `T` which `Range<T>` implements `ToSql<ST>`
186    /// - [`&[T]`][slice] for any `T` which `Range<T>` implements `ToSql<ST>`
187    ///
188    /// ### [`FromSql`] impls
189    ///
190    /// - [`Vec<T>`][Vec] for any `T` which implements `ToSql<Range<ST>>`
191    ///
192    /// [`ToSql`]: crate::serialize::ToSql
193    /// [`FromSql`]: crate::deserialize::FromSql
194    /// [Vec]: std::vec::Vec
195    /// [slice]: https://doc.rust-lang.org/nightly/std/primitive.slice.html
196    /// [`Multirange`]: https://www.postgresql.org/docs/current/rangetypes.html
197    #[derive(#[automatically_derived]
impl<ST: ::core::fmt::Debug + 'static> ::core::fmt::Debug for Multirange<ST> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Multirange",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl<ST: ::core::clone::Clone + 'static> ::core::clone::Clone for
    Multirange<ST> {
    #[inline]
    fn clone(&self) -> Multirange<ST> {
        Multirange(::core::clone::Clone::clone(&self.0))
    }
}Clone, #[automatically_derived]
impl<ST: ::core::marker::Copy + 'static> ::core::marker::Copy for
    Multirange<ST> {
}Copy, #[automatically_derived]
impl<ST: ::core::default::Default + 'static> ::core::default::Default for
    Multirange<ST> {
    #[inline]
    fn default() -> Multirange<ST> {
        Multirange(::core::default::Default::default())
    }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<ST: 'static + diesel::query_builder::QueryId>
            diesel::query_builder::QueryId for Multirange<ST> {
            type QueryId =
                Multirange<<ST as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <ST as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                    true;
            const IS_WINDOW_FUNCTION: bool =
                <ST as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl<ST: 'static> diesel::sql_types::SqlType for Multirange<ST> {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl<ST: 'static> diesel::sql_types::SingleValue for Multirange<ST> {}
    };SqlType)]
198    #[cfg(feature = "postgres_backend")]
199    pub struct Multirange<ST: 'static>(ST);
200
201    #[doc(hidden)]
202    pub type Int4multirange = Multirange<crate::sql_types::Int4>;
203    #[doc(hidden)]
204    pub type Int8multirange = Multirange<crate::sql_types::Int8>;
205    #[doc(hidden)]
206    pub type Datemultirange = Multirange<crate::sql_types::Date>;
207    #[doc(hidden)]
208    pub type Nummultirange = Multirange<crate::sql_types::Numeric>;
209    #[doc(hidden)]
210    pub type Tsmultirange = Multirange<crate::sql_types::Timestamp>;
211    #[doc(hidden)]
212    pub type Tstzmultirange = Multirange<crate::sql_types::Timestamptz>;
213
214    /// This is a wrapper for [`NullValueTreatment`] to represent null_value_treatment for jsonb_seet_lax:
215    ///     'raise_exception' 'use_json_null' 'delete_key' 'return_target'
216    /// used in functions jsonb_set_lax
217    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for NullValueTreatmentEnum {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "NullValueTreatmentEnum")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for NullValueTreatmentEnum {
    #[inline]
    fn clone(&self) -> NullValueTreatmentEnum { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for NullValueTreatmentEnum { }Copy, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for NullValueTreatmentEnum {
            type QueryId = NullValueTreatmentEnum<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for NullValueTreatmentEnum {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for NullValueTreatmentEnum {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<NullValueTreatmentEnum> for
            diesel::pg::Pg {
            fn metadata(lookup: &mut Self::MetadataLookup) -> PgTypeMetadata {
                lookup.lookup_type("text", None)
            }
        }
    };SqlType)]
218    #[cfg(feature = "postgres_backend")]
219    #[diesel(postgres_type(name = "text"))]
220    pub struct NullValueTreatmentEnum;
221
222    /// Represent null_value_treatment for jsonb_seet_lax:
223    ///     'raise_exception' 'use_json_null' 'delete_key' 'return_target'
224    /// used in functions jsonb_seet_lax.
225    #[derive(#[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::fmt::Debug for NullValueTreatment {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                NullValueTreatment::RaiseException => "RaiseException",
                NullValueTreatment::UseJsonNull => "UseJsonNull",
                NullValueTreatment::DeleteKey => "DeleteKey",
                NullValueTreatment::ReturnTarget => "ReturnTarget",
            })
    }
}Debug, #[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::clone::Clone for NullValueTreatment {
    #[inline]
    fn clone(&self) -> NullValueTreatment { *self }
}Clone, #[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::marker::Copy for NullValueTreatment { }Copy, const _: () =
    {
        use diesel;
        impl<'__expr> diesel::expression::AsExpression<NullValueTreatmentEnum>
            for &'__expr NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<NullValueTreatmentEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<NullValueTreatmentEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr>
            diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>
            for &'__expr NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<NullValueTreatmentEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr, '__expr2>
            diesel::expression::AsExpression<NullValueTreatmentEnum> for
            &'__expr2 &'__expr NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<NullValueTreatmentEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<NullValueTreatmentEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr, '__expr2>
            diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>
            for &'__expr2 &'__expr NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<NullValueTreatmentEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<__DB>
            diesel::serialize::ToSql<diesel::sql_types::Nullable<NullValueTreatmentEnum>,
            __DB> for NullValueTreatment where __DB: diesel::backend::Backend,
            Self: diesel::serialize::ToSql<NullValueTreatmentEnum, __DB> {
            fn to_sql<'__b>(&'__b self,
                out: &mut diesel::serialize::Output<'__b, '_, __DB>)
                -> diesel::serialize::Result {
                diesel::serialize::ToSql::<NullValueTreatmentEnum,
                        __DB>::to_sql(self, out)
            }
        }
        impl diesel::expression::AsExpression<NullValueTreatmentEnum> for
            NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<NullValueTreatmentEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<NullValueTreatmentEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>
            for NullValueTreatment {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<NullValueTreatmentEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<NullValueTreatmentEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
    };diesel_derives::AsExpression)]
226    #[diesel(sql_type = NullValueTreatmentEnum)]
227    #[allow(clippy::enum_variant_names)]
228    pub enum NullValueTreatment {
229        /// postgres 'raise_exception'
230        RaiseException,
231        /// postgres 'use_json_null'
232        UseJsonNull,
233        /// postgres 'delete_key'
234        DeleteKey,
235        /// postgres 'return_target'
236        ReturnTarget,
237    }
238
239    /// This is a wrapper for [`RangeBound`] to represent range bounds: '[]', '(]', '[)', '()',
240    /// used in functions int4range, int8range, numrange, tsrange, tstzrange, daterange.
241    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for RangeBoundEnum {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "RangeBoundEnum")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for RangeBoundEnum {
    #[inline]
    fn clone(&self) -> RangeBoundEnum { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for RangeBoundEnum { }Copy, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for RangeBoundEnum {
            type QueryId = RangeBoundEnum<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for RangeBoundEnum {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for RangeBoundEnum {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<RangeBoundEnum> for diesel::pg::Pg
            {
            fn metadata(lookup: &mut Self::MetadataLookup) -> PgTypeMetadata {
                lookup.lookup_type("text", None)
            }
        }
    };SqlType)]
242    #[cfg(feature = "postgres_backend")]
243    #[diesel(postgres_type(name = "text"))]
244    pub struct RangeBoundEnum;
245
246    /// Represent postgres range bounds: '[]', '(]', '[)', '()',
247    /// used in functions int4range, int8range, numrange, tsrange, tstzrange, daterange.
248    #[derive(#[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::fmt::Debug for RangeBound {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RangeBound::LowerBoundInclusiveUpperBoundInclusive =>
                    "LowerBoundInclusiveUpperBoundInclusive",
                RangeBound::LowerBoundInclusiveUpperBoundExclusive =>
                    "LowerBoundInclusiveUpperBoundExclusive",
                RangeBound::LowerBoundExclusiveUpperBoundInclusive =>
                    "LowerBoundExclusiveUpperBoundInclusive",
                RangeBound::LowerBoundExclusiveUpperBoundExclusive =>
                    "LowerBoundExclusiveUpperBoundExclusive",
            })
    }
}Debug, #[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::clone::Clone for RangeBound {
    #[inline]
    fn clone(&self) -> RangeBound { *self }
}Clone, #[automatically_derived]
#[allow(clippy::enum_variant_names)]
impl ::core::marker::Copy for RangeBound { }Copy, const _: () =
    {
        use diesel;
        impl<'__expr> diesel::expression::AsExpression<RangeBoundEnum> for
            &'__expr RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<RangeBoundEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<RangeBoundEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr>
            diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>
            for &'__expr RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<RangeBoundEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr, '__expr2>
            diesel::expression::AsExpression<RangeBoundEnum> for
            &'__expr2 &'__expr RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<RangeBoundEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<RangeBoundEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<'__expr, '__expr2>
            diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>
            for &'__expr2 &'__expr RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<RangeBoundEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl<__DB>
            diesel::serialize::ToSql<diesel::sql_types::Nullable<RangeBoundEnum>,
            __DB> for RangeBound where __DB: diesel::backend::Backend,
            Self: diesel::serialize::ToSql<RangeBoundEnum, __DB> {
            fn to_sql<'__b>(&'__b self,
                out: &mut diesel::serialize::Output<'__b, '_, __DB>)
                -> diesel::serialize::Result {
                diesel::serialize::ToSql::<RangeBoundEnum,
                        __DB>::to_sql(self, out)
            }
        }
        impl diesel::expression::AsExpression<RangeBoundEnum> for RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<RangeBoundEnum,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<RangeBoundEnum>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
        impl diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>
            for RangeBound {
            type Expression =
                diesel::internal::derives::as_expression::Bound<diesel::sql_types::Nullable<RangeBoundEnum>,
                Self>;
            fn as_expression(self)
                ->
                    <Self as
                    diesel::expression::AsExpression<diesel::sql_types::Nullable<RangeBoundEnum>>>::Expression {
                diesel::internal::derives::as_expression::Bound::new(self)
            }
        }
    };diesel_derives::AsExpression)]
249    #[diesel(sql_type = RangeBoundEnum)]
250    #[allow(clippy::enum_variant_names)]
251    pub enum RangeBound {
252        /// postgres '[]'
253        LowerBoundInclusiveUpperBoundInclusive,
254        /// postgres '[)'
255        LowerBoundInclusiveUpperBoundExclusive,
256        /// postgres '(]'
257        LowerBoundExclusiveUpperBoundInclusive,
258        /// postgres '()'
259        LowerBoundExclusiveUpperBoundExclusive,
260    }
261
262    /// The [`Record`] (a.k.a. tuple) SQL type.
263    ///
264    /// ### [`ToSql`] impls
265    ///
266    /// - Any tuple which can be serialized to each of the elements
267    ///   (note: There are major caveats, see the section below)
268    ///
269    /// ### [`FromSql`] impls
270    ///
271    /// - Any tuple which can be deserialized from each of the elements.
272    ///
273    /// [`ToSql`]: crate::serialize::ToSql
274    /// [`FromSql`]: crate::deserialize::FromSql
275    ///
276    /// ### Caveats about serialization
277    ///
278    /// Typically in the documentation for SQL types, we use "`FromSql` impls"
279    /// as a shorthand for "Rust types that you can use to represent this type".
280    /// For every other type, that means there is specifically an implementation
281    /// of the `FromSql` trait.
282    ///
283    /// However, PostgreSQL does not support transmission of anonymous record
284    /// types as bind parameters. It only supports transmission for named
285    /// composite types. For this reason, if you tried to do
286    /// `int_tuple_col.eq((1, 2))`, we will generate the SQL `int_tuple_col =
287    /// ($1, $2)` rather than `int_tuple_col = $1` as we would for anything
288    /// else.
289    ///
290    /// This should not be visible during normal usage. The only time this would
291    /// affect you is if you were attempting to use `sql_query` with tuples.
292    /// Your code would not compile in that case, as the `ToSql` trait itself is
293    /// not implemented.
294    ///
295    /// You can implement `ToSql` for named composite types. See [`WriteTuple`]
296    /// for details.
297    ///
298    /// [`WriteTuple`]: super::super::super::serialize::WriteTuple
299    /// [`Record`]: https://www.postgresql.org/docs/current/rowtypes.html
300    #[cfg(feature = "postgres_backend")]
301    #[derive(#[automatically_derived]
impl<ST: ::core::fmt::Debug + 'static> ::core::fmt::Debug for Record<ST> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Record",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl<ST: ::core::clone::Clone + 'static> ::core::clone::Clone for Record<ST> {
    #[inline]
    fn clone(&self) -> Record<ST> {
        Record(::core::clone::Clone::clone(&self.0))
    }
}Clone, #[automatically_derived]
impl<ST: ::core::marker::Copy + 'static> ::core::marker::Copy for Record<ST> {
}Copy, #[automatically_derived]
impl<ST: ::core::default::Default + 'static> ::core::default::Default for
    Record<ST> {
    #[inline]
    fn default() -> Record<ST> { Record(::core::default::Default::default()) }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<ST: 'static + diesel::query_builder::QueryId>
            diesel::query_builder::QueryId for Record<ST> {
            type QueryId =
                Record<<ST as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <ST as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                    true;
            const IS_WINDOW_FUNCTION: bool =
                <ST as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl<ST: 'static> diesel::sql_types::SqlType for Record<ST> {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl<ST: 'static> diesel::sql_types::SingleValue for Record<ST> {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl<ST: 'static> diesel::sql_types::HasSqlType<Record<ST>> for
            diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(2249, 2287)
            }
        }
    };SqlType)]
302    #[diesel(postgres_type(oid = 2249, array_oid = 2287))]
303    pub struct Record<ST: 'static>(ST);
304
305    /// Alias for [`SmallInt`](crate::sql_types::SmallInt)
306    #[cfg(feature = "postgres_backend")]
307    pub type SmallSerial = crate::sql_types::SmallInt;
308
309    /// Alias for [`Integer`](crate::sql_types::Integer)
310    #[cfg(feature = "postgres_backend")]
311    pub type Serial = crate::sql_types::Integer;
312
313    /// Alias for [`BigInt`](crate::sql_types::BigInt)
314    #[cfg(feature = "postgres_backend")]
315    pub type BigSerial = crate::sql_types::BigInt;
316
317    /// The [`UUID`] SQL type. This type can only be used with `feature = "uuid"`
318    ///
319    /// ### [`ToSql`] impls
320    ///
321    /// - [`uuid::Uuid`][Uuid]
322    ///
323    /// ### [`FromSql`] impls
324    ///
325    /// - [`uuid::Uuid`][Uuid]
326    ///
327    /// [`ToSql`]: crate::serialize::ToSql
328    /// [`FromSql`]: crate::deserialize::FromSql
329    /// [Uuid]: https://docs.rs/uuid/*/uuid/struct.Uuid.html
330    /// [`UUID`]: https://www.postgresql.org/docs/current/datatype-uuid.html
331    #[cfg(feature = "postgres_backend")]
332    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Uuid {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Uuid")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Uuid {
    #[inline]
    fn clone(&self) -> Uuid { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Uuid { }Copy, #[automatically_derived]
impl ::core::default::Default for Uuid {
    #[inline]
    fn default() -> Uuid { Uuid {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Uuid {
            type QueryId = Uuid<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Uuid {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Uuid {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Uuid> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(2950, 2951)
            }
        }
    };SqlType)]
333    #[diesel(postgres_type(oid = 2950, array_oid = 2951))]
334    pub struct Uuid;
335
336    /// Alias for `Binary`, to ensure `diesel print-schema` works
337    pub type Bytea = crate::sql_types::Binary;
338
339    #[doc(hidden)]
340    pub type Bpchar = crate::sql_types::VarChar;
341
342    /// The PostgreSQL [Money](https://www.postgresql.org/docs/current/static/datatype-money.html) type.
343    ///
344    /// ### [`ToSql`] impls
345    ///
346    /// - [`Cents` (also aliased as `PgMoney`)][PgMoney]
347    ///
348    /// ### [`FromSql`] impls
349    ///
350    /// - [`Cents` (also aliased as `PgMoney`)][PgMoney]
351    ///
352    /// [`ToSql`]: crate::serialize::ToSql
353    /// [`FromSql`]: crate::deserialize::FromSql
354    /// [PgMoney]: crate::data_types::PgMoney
355    ///
356    /// # Examples
357    ///
358    /// ```rust
359    /// # include!("../../doctest_setup.rs");
360    /// use diesel::data_types::Cents;
361    ///
362    /// table! {
363    ///     items {
364    ///         id -> Integer,
365    ///         name -> VarChar,
366    ///         price -> Money,
367    ///     }
368    /// }
369    ///
370    /// # fn main() {
371    /// #     use diesel::insert_into;
372    /// #     use self::items::dsl::*;
373    /// #     let connection = &mut connection_no_data();
374    /// #     diesel::sql_query("CREATE TABLE items (
375    /// #         id SERIAL PRIMARY KEY,
376    /// #         name VARCHAR NOT NULL,
377    /// #         price MONEY NOT NULL
378    /// #     )").execute(connection).unwrap();
379    /// let inserted_price = insert_into(items)
380    ///     .values((name.eq("Shiny Thing"), price.eq(Cents(123_456))))
381    ///     .returning(price)
382    ///     .get_result(connection);
383    /// assert_eq!(Ok(Cents(123_456)), inserted_price);
384    /// # }
385    /// ```
386    #[cfg(feature = "postgres_backend")]
387    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Money {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Money")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Money {
    #[inline]
    fn clone(&self) -> Money { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Money { }Copy, #[automatically_derived]
impl ::core::default::Default for Money {
    #[inline]
    fn default() -> Money { Money {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Money {
            type QueryId = Money<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Money {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Money {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Money> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(790, 791)
            }
        }
    };SqlType)]
388    #[diesel(postgres_type(oid = 790, array_oid = 791))]
389    pub struct Money;
390
391    /// The [`MACADDR`](https://www.postgresql.org/docs/current/static/datatype-net-types.html) SQL type.
392    ///
393    /// ### [`ToSql`] impls
394    ///
395    /// - `[u8; 6]`
396    ///
397    /// ### [`FromSql`] impls
398    ///
399    /// - `[u8; 6]`
400    ///
401    /// [`ToSql`]: crate::serialize::ToSql
402    /// [`FromSql`]: crate::deserialize::FromSql
403    ///
404    /// # Examples
405    ///
406    /// ```rust
407    /// # include!("../../doctest_setup.rs");
408    /// table! {
409    ///     devices {
410    ///         id -> Integer,
411    ///         macaddr -> MacAddr,
412    ///     }
413    /// }
414    ///
415    /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
416    /// #     use diesel::insert_into;
417    /// #     use self::devices::dsl::*;
418    /// #     let connection = &mut connection_no_data();
419    /// #     diesel::sql_query("CREATE TABLE devices (
420    /// #         id SERIAL PRIMARY KEY,
421    /// #         macaddr MACADDR NOT NULL
422    /// #     )").execute(connection)?;
423    /// let inserted_macaddr = insert_into(devices)
424    ///     .values(macaddr.eq([0x08, 0x00, 0x2b, 0x01, 0x02, 0x03]))
425    ///     .returning(macaddr)
426    ///     .get_result::<[u8; 6]>(connection)?;
427    /// assert_eq!([0x08, 0x00, 0x2b, 0x01, 0x02, 0x03], inserted_macaddr);
428    /// #     Ok(())
429    /// # }
430    /// ```
431    #[cfg(feature = "postgres_backend")]
432    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for MacAddr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "MacAddr")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MacAddr {
    #[inline]
    fn clone(&self) -> MacAddr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MacAddr { }Copy, #[automatically_derived]
impl ::core::default::Default for MacAddr {
    #[inline]
    fn default() -> MacAddr { MacAddr {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for MacAddr {
            type QueryId = MacAddr<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for MacAddr {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for MacAddr {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<MacAddr> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(829, 1040)
            }
        }
    };SqlType)]
433    #[diesel(postgres_type(oid = 829, array_oid = 1040))]
434    pub struct MacAddr;
435
436    /// Alias for `MacAddr` to be able to use it with `diesel print-schema`.
437    pub type Macaddr = MacAddr;
438
439    /// The [`MACADDR8`](https://www.postgresql.org/docs/current/static/datatype-net-types.html) SQL type.
440    ///
441    /// ### [`ToSql`] impls
442    ///
443    /// - `[u8; 8]`
444    ///
445    /// ### [`FromSql`] impls
446    ///
447    /// - `[u8; 8]`
448    ///
449    /// [`ToSql`]: crate::serialize::ToSql
450    /// [`FromSql`]: crate::deserialize::FromSql
451    ///
452    /// # Examples
453    ///
454    /// ```rust
455    /// # include!("../../doctest_setup.rs");
456    /// table! {
457    ///     devices {
458    ///         id -> Integer,
459    ///         macaddr -> MacAddr8,
460    ///     }
461    /// }
462    ///
463    /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
464    /// #     use diesel::insert_into;
465    /// #     use self::devices::dsl::*;
466    /// #     let connection = &mut connection_no_data();
467    /// #     diesel::sql_query("CREATE TABLE devices (
468    /// #         id SERIAL PRIMARY KEY,
469    /// #         macaddr MACADDR8 NOT NULL
470    /// #     )").execute(connection)?;
471    /// let inserted_macaddr = insert_into(devices)
472    ///     .values(macaddr.eq([0x08, 0x00, 0x2b, 0x01, 0x02, 0x03, 0x04, 0x05]))
473    ///     .returning(macaddr)
474    ///     .get_result::<[u8; 8]>(connection)?;
475    /// assert_eq!(
476    ///     [0x08, 0x00, 0x2b, 0x01, 0x02, 0x03, 0x04, 0x05],
477    ///     inserted_macaddr
478    /// );
479    /// #     Ok(())
480    /// # }
481    /// ```
482    #[cfg(feature = "postgres_backend")]
483    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for MacAddr8 {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "MacAddr8")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MacAddr8 {
    #[inline]
    fn clone(&self) -> MacAddr8 { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MacAddr8 { }Copy, #[automatically_derived]
impl ::core::default::Default for MacAddr8 {
    #[inline]
    fn default() -> MacAddr8 { MacAddr8 {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for MacAddr8 {
            type QueryId = MacAddr8<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for MacAddr8 {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for MacAddr8 {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<MacAddr8> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(774, 775)
            }
        }
    };SqlType)]
484    #[diesel(postgres_type(oid = 774, array_oid = 775))]
485    pub struct MacAddr8;
486
487    /// Alias for `MacAddr` to be able to use it with `diesel print-schema`.
488    pub type Macaddr8 = MacAddr8;
489
490    /// The [`INET`](https://www.postgresql.org/docs/current/static/datatype-net-types.html) SQL type. This type can only be used with `feature = "network-address"` or `feature = "ipnet-address"`.
491    ///
492    /// ### [`ToSql`] impls
493    #[cfg_attr(
494        feature = "network-address",
495        doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
496    )]
497    #[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
498    #[cfg_attr(
499        not(any(feature = "network-address", feature = "ipnet-address")),
500        doc = "N/A"
501    )]
502    ///
503    /// ### [`FromSql`] impls
504    #[cfg_attr(
505        feature = "network-address",
506        doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
507    )]
508    #[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
509    #[cfg_attr(
510        not(any(feature = "network-address", feature = "ipnet-address")),
511        doc = "N/A"
512    )]
513    ///
514    /// [`ToSql`]: crate::serialize::ToSql
515    /// [`FromSql`]: crate::deserialize::FromSql
516    #[cfg_attr(
517        feature = "network-address",
518        doc = " [IpNetwork]: ipnetwork::IpNetwork"
519    )]
520    #[cfg_attr(feature = "ipnet-address", doc = " [IpNet]: ipnet::IpNet")]
521    ///
522    /// # Examples
523    ///
524    /// ```rust
525    /// # include!("../../doctest_setup.rs");
526    /// #
527    /// table! {
528    ///     clients {
529    ///         id -> Integer,
530    ///         ip_address -> Inet,
531    ///     }
532    /// }
533    ///
534    /// # #[cfg(any(feature = "network-address", feature = "ipnet-address"))]
535    /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
536    ///
537    /// #     use diesel::insert_into;
538    /// #     use self::clients::dsl::*;
539    /// #     let connection = &mut connection_no_data();
540    /// #     diesel::sql_query("CREATE TABLE clients (
541    /// #         id SERIAL PRIMARY KEY,
542    /// #         ip_address INET NOT NULL
543    /// #     )").execute(connection)?;
544    /// // Parsing "ipnet::IpNet" would also work.
545    /// let addr = "10.1.9.32/32".parse::<ipnetwork::IpNetwork>()?;
546    /// let inserted_address = insert_into(clients)
547    ///     .values(ip_address.eq(&addr))
548    ///     .returning(ip_address)
549    ///     .get_result(connection)?;
550    /// assert_eq!(addr, inserted_address);
551    /// #     Ok(())
552    /// # }
553    /// #
554    /// # #[cfg(not(any(feature = "network-address", feature = "ipnet-address")))]
555    /// # fn main() {}
556    /// ```
557    #[cfg(feature = "postgres_backend")]
558    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Inet {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Inet")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Inet {
    #[inline]
    fn clone(&self) -> Inet { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Inet { }Copy, #[automatically_derived]
impl ::core::default::Default for Inet {
    #[inline]
    fn default() -> Inet { Inet {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Inet {
            type QueryId = Inet<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Inet {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Inet {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Inet> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(869, 1041)
            }
        }
    };SqlType)]
559    #[diesel(postgres_type(oid = 869, array_oid = 1041))]
560    pub struct Inet;
561
562    /// The [`CIDR`](https://www.postgresql.org/docs/postgresql/static/datatype-net-types.html) SQL type. This type can only be used with `feature = "network-address"` or `feature = "ipnet-address"`.
563    ///
564    /// ### [`ToSql`] impls
565    #[cfg_attr(
566        feature = "network-address",
567        doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
568    )]
569    #[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
570    #[cfg_attr(
571        not(any(feature = "network-address", feature = "ipnet-address")),
572        doc = "N/A"
573    )]
574    ///
575    /// ### [`FromSql`] impls
576    #[cfg_attr(
577        feature = "network-address",
578        doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
579    )]
580    #[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
581    #[cfg_attr(
582        not(any(feature = "network-address", feature = "ipnet-address")),
583        doc = "N/A"
584    )]
585    ///
586    /// [`ToSql`]: crate::serialize::ToSql
587    /// [`FromSql`]: crate::deserialize::FromSql
588    #[cfg_attr(
589        feature = "network-address",
590        doc = " [IpNetwork]: ipnetwork::IpNetwork"
591    )]
592    #[cfg_attr(feature = "ipnet-address", doc = " [IpNet]: ipnet::IpNet")]
593    ///
594    /// # Examples
595    ///
596    /// ```rust
597    /// # #![allow(dead_code)]
598    /// # include!("../../doctest_setup.rs");
599    /// table! {
600    ///     clients {
601    ///         id -> Integer,
602    ///         ip_address -> Cidr,
603    ///     }
604    /// }
605    ///
606    /// # #[cfg(any(feature = "network-address", feature = "ipnet-address"))]
607    /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
608    ///
609    /// #     use diesel::insert_into;
610    /// #     use self::clients::dsl::*;
611    /// #     let connection = &mut connection_no_data();
612    /// #     diesel::sql_query("CREATE TABLE clients (
613    /// #         id SERIAL PRIMARY KEY,
614    /// #         ip_address CIDR NOT NULL
615    /// #     )").execute(connection)?;
616    /// // Parsing "ipnet::IpNet" would also work.
617    /// let addr = "10.1.9.32/32".parse::<ipnetwork::IpNetwork>()?;
618    /// let inserted_addr = insert_into(clients)
619    ///     .values(ip_address.eq(&addr))
620    ///     .returning(ip_address)
621    ///     .get_result(connection)?;
622    /// assert_eq!(addr, inserted_addr);
623    /// #     Ok(())
624    /// # }
625    /// # #[cfg(not(any(feature = "network-address", feature = "ipnet-address")))]
626    /// # fn main() {}
627    /// ```
628    #[cfg(feature = "postgres_backend")]
629    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Cidr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Cidr")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Cidr {
    #[inline]
    fn clone(&self) -> Cidr { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Cidr { }Copy, #[automatically_derived]
impl ::core::default::Default for Cidr {
    #[inline]
    fn default() -> Cidr { Cidr {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Cidr {
            type QueryId = Cidr<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Cidr {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Cidr {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Cidr> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(650, 651)
            }
        }
    };SqlType)]
630    #[diesel(postgres_type(oid = 650, array_oid = 651))]
631    pub struct Cidr;
632
633    /// The [`"char"`] SQL type. This is a PostgreSQL specific type. Used for e.g. [setweight]. [Do not use in user tables].
634    ///
635    /// ### [`ToSql`] impls
636    ///
637    /// - [`u8`]
638    ///
639    /// ### [`FromSql`] impls
640    ///
641    /// - [`u8`]
642    ///
643    /// [`ToSql`]: crate::serialize::ToSql
644    /// [`FromSql`]: crate::deserialize::FromSql
645    /// [`u8`]: https://doc.rust-lang.org/nightly/std/primitive.u8.html
646    /// [`"char"`]: https://www.postgresql.org/docs/current/datatype-character.html#DATATYPE-CHARACTER-SPECIAL-TABLE
647    /// [setweight]: https://www.postgresql.org/docs/current/functions-textsearch.html
648    /// [Do not use in user tables]: https://www.postgresql.org/docs/current/datatype-character.html#DATATYPE-CHARACTER-SPECIAL-TABLE
649    #[cfg(feature = "postgres_backend")]
650    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for CChar {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "CChar")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for CChar {
    #[inline]
    fn clone(&self) -> CChar { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for CChar { }Copy, #[automatically_derived]
impl ::core::default::Default for CChar {
    #[inline]
    fn default() -> CChar { CChar {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for CChar {
            type QueryId = CChar<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for CChar {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for CChar {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<CChar> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(18, 1002)
            }
        }
    };SqlType)]
651    #[diesel(postgres_type(oid = 18, array_oid = 1002))]
652    pub struct CChar;
653
654    /// The [`Citext`] SQL type. This is a PostgreSQL specific type.
655    ///
656    /// Strings must be valid UTF-8.
657    ///
658    /// ### [`ToSql`] impls
659    ///
660    /// - [`String`]
661    /// - [`&str`][str]
662    ///
663    /// ### [`FromSql`] impls
664    ///
665    /// - [`String`]
666    ///
667    /// [`ToSql`]: crate::serialize::ToSql
668    /// [`FromSql`]: crate::deserialize::FromSql
669    /// [`Citext`]: https://www.postgresql.org/docs/current/citext.html
670    #[cfg(feature = "postgres_backend")]
671    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for Citext {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Citext")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Citext {
    #[inline]
    fn clone(&self) -> Citext { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Citext { }Copy, #[automatically_derived]
impl ::core::default::Default for Citext {
    #[inline]
    fn default() -> Citext { Citext {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for Citext {
            type QueryId = Citext<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for Citext {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for Citext {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<Citext> for diesel::pg::Pg {
            fn metadata(lookup: &mut Self::MetadataLookup) -> PgTypeMetadata {
                lookup.lookup_type("citext", None)
            }
        }
    };SqlType)]
672    #[diesel(postgres_type(name = "citext"))]
673    pub struct Citext;
674
675    /// The [`pg_lsn`] SQL type. This is a PostgreSQL specific type. Encodes a position in the PostgreSQL *Write Ahead Log* (WAL).
676    ///
677    /// ### [`ToSql`] impls
678    ///
679    /// - [`u64`]
680    ///
681    /// ### [`FromSql`] impls
682    ///
683    /// - [`u64`]
684    ///
685    /// [`ToSql`]: crate::serialize::ToSql
686    /// [`FromSql`]: crate::deserialize::FromSql
687    /// [`u64`]: https://doc.rust-lang.org/nightly/std/primitive.u64.html
688    /// [`pg_lsn`]: https://www.postgresql.org/docs/current/datatype-pg-lsn.html
689    #[cfg(feature = "postgres_backend")]
690    #[derive(#[automatically_derived]
impl ::core::fmt::Debug for PgLsn {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "PgLsn")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for PgLsn {
    #[inline]
    fn clone(&self) -> PgLsn { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for PgLsn { }Copy, #[automatically_derived]
impl ::core::default::Default for PgLsn {
    #[inline]
    fn default() -> PgLsn { PgLsn {} }
}Default, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl diesel::query_builder::QueryId for PgLsn {
            type QueryId = PgLsn<>;
            const HAS_STATIC_QUERY_ID: bool = true;
            const IS_WINDOW_FUNCTION: bool = false;
        }
    };QueryId, const _: () =
    {
        use diesel;
        impl diesel::sql_types::SqlType for PgLsn {
            type IsNull = diesel::sql_types::is_nullable::NotNull;
            const IS_ARRAY: bool = false;
        }
        impl diesel::sql_types::SingleValue for PgLsn {}
        use diesel::pg::{PgMetadataLookup, PgTypeMetadata};
        impl diesel::sql_types::HasSqlType<PgLsn> for diesel::pg::Pg {
            fn metadata(_: &mut Self::MetadataLookup) -> PgTypeMetadata {
                PgTypeMetadata::new(3220, 3221)
            }
        }
    };SqlType)]
691    #[diesel(postgres_type(oid = 3220, array_oid = 3221))]
692    pub struct PgLsn;
693
694    #[doc(inline)]
695    pub use crate::sql_types::Jsonb;
696}
697
698mod ops {
699    use super::sql_types::*;
700    use crate::sql_types::ops::*;
701    use crate::sql_types::{Bigint, Interval};
702
703    impl Add for Timestamptz {
704        type Rhs = Interval;
705        type Output = Timestamptz;
706    }
707
708    impl Sub for Timestamptz {
709        type Rhs = Interval;
710        type Output = Timestamptz;
711    }
712
713    impl Add for Cidr {
714        type Rhs = Bigint;
715        type Output = Inet;
716    }
717
718    impl Add for Inet {
719        type Rhs = Bigint;
720        type Output = Inet;
721    }
722
723    impl Sub for Cidr {
724        type Rhs = Bigint;
725        type Output = Inet;
726    }
727
728    impl Sub for Inet {
729        type Rhs = Bigint;
730        type Output = Inet;
731    }
732}