pub struct Page { /* private fields */ }
Expand description
Page struct for pagination.
This is a simple struct to handle pagination for queries.
#[derive(Table, Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
pub struct Users {
pub id: PrimaryKeyInteger,
pub username: String,
pub age: i32,
pub postcode: Option<String>,
}
// Create a new Page instance
let mut page = Page::new();
// Update the page to the next page
page.next();
// Build a query to select rows from the table
let select_query = Users::query_select()
.where_eq("username", "geekmasher")
.page(&page)
.order_by("age", QueryOrder::Asc)
.build()
.expect("Failed to build select query");
let page_max = Page::from((1, 10_000));
let option_page = Page::from((Some(5), Some(10)));
Implementations§
Trait Implementations§
Source§impl From<(Option<u32>, Option<u32>, u32)> for Page
Implement From for Page (page, limit, total)
impl From<(Option<u32>, Option<u32>, u32)> for Page
Implement From for Page (page, limit, total)
Auto Trait Implementations§
impl Freeze for Page
impl RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl UnwindSafe for Page
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request