pub struct Paginated<'db, E>where
E: EntityTrait,{ /* private fields */ }Expand description
A paginated query awaiting a page number and a fetch.
Construct via crate::Query::paginate. Chain .page(n) (1-based) then
.fetch(), or call .fetch() directly for page 1.
Implementations§
Source§impl<'db, E> Paginated<'db, E>where
E: EntityTrait,
impl<'db, E> Paginated<'db, E>where
E: EntityTrait,
Sourcepub fn page(self, page: u64) -> Self
pub fn page(self, page: u64) -> Self
Select a 1-based page number. Page 0 is rejected at Paginated::fetch
time with a typed PaginationError::PageMustBePositive.
Sourcepub async fn fetch(self) -> Result<Page<E::Model>, DataError>
pub async fn fetch(self) -> Result<Page<E::Model>, DataError>
Run the count + page query and return a typed Page.
§Errors
Returns DataError::Pagination if page is 0 or per_page is 0,
and DataError::Database if the underlying SeaORM queries fail.
Auto Trait Implementations§
impl<'db, E> !RefUnwindSafe for Paginated<'db, E>
impl<'db, E> !UnwindSafe for Paginated<'db, E>
impl<'db, E> Freeze for Paginated<'db, E>
impl<'db, E> Send for Paginated<'db, E>
impl<'db, E> Sync for Paginated<'db, E>
impl<'db, E> Unpin for Paginated<'db, E>where
E: Unpin,
impl<'db, E> UnsafeUnpin for Paginated<'db, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more