Struct rbatis::plugin::page::Page

source ·
pub struct Page<T: Send + Sync> {
    pub records: Vec<T>,
    pub total: u64,
    pub page_no: u64,
    pub page_size: u64,
    pub do_count: bool,
}

Fields§

§records: Vec<T>

data

§total: u64

total num

§page_no: u64

current page index

§page_size: u64

default 10

§do_count: bool

Control whether to execute count statements to count the total number

Implementations§

source§

impl<T: Send + Sync> Page<T>

source

pub fn new(current: u64, page_size: u64) -> Self

source

pub fn new_option(current: &Option<u64>, page_size: &Option<u64>) -> Self

source

pub fn new_total(page_no: u64, page_size: u64, total: u64) -> Self

source

pub fn make_pages(data: Vec<T>, page_size: u64) -> Vec<Page<T>>

create Vec from data

source

pub fn make_ranges(total: u64, page_size: u64) -> Vec<(u64, u64)>

create (Vec<offset,limit>) from total,page_size

source

pub fn set_total(self, total: u64) -> Self

source

pub fn set_page_size(self, arg: u64) -> Self

source

pub fn set_page_no(self, arg: u64) -> Self

source

pub fn set_do_count(self, arg: bool) -> Self

Control whether to execute count statements to count the total number

source§

impl<V: Send + Sync> Page<V>

source

pub fn from<T: Send + Sync>(arg: Page<T>) -> Self
where V: From<T>,

Trait Implementations§

source§

impl<T: Clone + Send + Sync> Clone for Page<T>

source§

fn clone(&self) -> Page<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + Send + Sync> Debug for Page<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Send + Sync> Default for Page<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de, T> Deserialize<'de> for Page<T>
where T: Deserialize<'de> + Send + Sync,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Display + Debug + Send + Sync> Display for Page<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Send + Sync> IPage<T> for Page<T>

source§

fn get_records(&self) -> &Vec<T>

source§

fn get_records_mut(&mut self) -> &mut Vec<T>

source§

fn set_records(self, arg: Vec<T>) -> Self

source§

impl<T: Send + Sync> IPageRequest for Page<T>

source§

fn page_size(&self) -> u64

source§

fn page_no(&self) -> u64

source§

fn total(&self) -> u64

source§

fn do_count(&self) -> bool

Control whether to execute count statements to count the total number
source§

fn set_total(&mut self, arg: u64)

source§

fn set_page_size(&mut self, arg: u64)

source§

fn set_page_no(&mut self, arg: u64)

source§

fn set_do_count(&mut self, arg: bool)

Control execute select count(1) from table
source§

fn pages(&self) -> u64

sum pages
source§

fn offset(&self) -> u64

sum offset
source§

fn offset_limit(&self) -> u64

sum offset_limit
source§

fn search_count(&self) -> bool

👎Deprecated: please use do_count()
source§

fn set_search_count(&mut self, arg: bool)

👎Deprecated: please use set_do_count()
source§

impl<T: PartialEq + Send + Sync> PartialEq for Page<T>

source§

fn eq(&self, other: &Page<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Page<T>
where T: Serialize + Send + Sync,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Eq + Send + Sync> Eq for Page<T>

source§

impl<T: Send + Sync> StructuralPartialEq for Page<T>

Auto Trait Implementations§

§

impl<T> Freeze for Page<T>

§

impl<T> RefUnwindSafe for Page<T>
where T: RefUnwindSafe,

§

impl<T> Send for Page<T>

§

impl<T> Sync for Page<T>

§

impl<T> Unpin for Page<T>
where T: Unpin,

§

impl<T> UnwindSafe for Page<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,