Skip to main content

diesel/query_builder/
limit_offset_clause.rs

1use super::QueryFragment;
2use crate::query_builder::QueryId;
3use alloc::boxed::Box;
4
5/// A helper query node that contains both limit and offset clauses
6///
7/// This type is only relevant for implementing custom backends
8#[derive(#[automatically_derived]
impl<Limit: ::core::fmt::Debug, Offset: ::core::fmt::Debug> ::core::fmt::Debug
    for LimitOffsetClause<Limit, Offset> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "LimitOffsetClause", "limit_clause", &self.limit_clause,
            "offset_clause", &&self.offset_clause)
    }
}Debug, #[automatically_derived]
impl<Limit: ::core::clone::Clone, Offset: ::core::clone::Clone>
    ::core::clone::Clone for LimitOffsetClause<Limit, Offset> {
    #[inline]
    fn clone(&self) -> LimitOffsetClause<Limit, Offset> {
        LimitOffsetClause {
            limit_clause: ::core::clone::Clone::clone(&self.limit_clause),
            offset_clause: ::core::clone::Clone::clone(&self.offset_clause),
        }
    }
}Clone, #[automatically_derived]
impl<Limit: ::core::marker::Copy, Offset: ::core::marker::Copy>
    ::core::marker::Copy for LimitOffsetClause<Limit, Offset> {
}Copy, const _: () =
    {
        use diesel;
        #[allow(non_camel_case_types)]
        impl<Limit: diesel::query_builder::QueryId,
            Offset: diesel::query_builder::QueryId>
            diesel::query_builder::QueryId for
            LimitOffsetClause<Limit, Offset> {
            type QueryId =
                LimitOffsetClause<<Limit as
                diesel::query_builder::QueryId>::QueryId,
                <Offset as diesel::query_builder::QueryId>::QueryId>;
            const HAS_STATIC_QUERY_ID: bool =
                <Limit as diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID
                        &&
                        <Offset as
                            diesel::query_builder::QueryId>::HAS_STATIC_QUERY_ID &&
                    true;
            const IS_WINDOW_FUNCTION: bool =
                <Limit as diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION
                        ||
                        <Offset as
                            diesel::query_builder::QueryId>::IS_WINDOW_FUNCTION ||
                    false;
        }
    };QueryId)]
9#[cfg_attr(
10    diesel_docsrs,
11    doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
12)]
13pub struct LimitOffsetClause<Limit, Offset> {
14    /// The limit clause
15    pub limit_clause: Limit,
16    /// The offset clause
17    pub offset_clause: Offset,
18}
19
20/// A boxed variant of [`LimitOffsetClause`](LimitOffsetClause)
21///
22/// This type is only relevant for implementing custom backends
23#[allow(missing_debug_implementations)]
24#[cfg_attr(
25    diesel_docsrs,
26    doc(cfg(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"))
27)]
28pub struct BoxedLimitOffsetClause<'a, DB> {
29    /// The limit clause
30    pub limit: Option<Box<dyn QueryFragment<DB> + Send + 'a>>,
31    /// The offset clause
32    pub offset: Option<Box<dyn QueryFragment<DB> + Send + 'a>>,
33}