pub struct HttpPaginationOptions {
pub limit: Option<u64>,
pub offset: Option<u64>,
pub reverse: Option<bool>,
}
Expand description
HTTP pagination options allow for lazy reading of large sets of data, for example if thousands of messages have been sent and received from a phone number it would be impractical to request all of them at the same time, instead it can be read in shorter pages using limit+offset. This is applied at the server level when requesting data from database.
Fields§
§limit: Option<u64>
The maximum amount of return values.
offset: Option<u64>
The offset in index to start getting values from. Eg, if the limit was 5, and you want to view page 2, the offset would be 5, then 10, 15, …
reverse: Option<bool>
Should return values be reversed? This is useful for getting the first results from a large set without having to know it’s size.
Implementations§
Source§impl HttpPaginationOptions
impl HttpPaginationOptions
Sourcepub fn with_limit(self, limit: u64) -> Self
pub fn with_limit(self, limit: u64) -> Self
Set the limit/page size.
Sourcepub fn with_offset(self, offset: u64) -> Self
pub fn with_offset(self, offset: u64) -> Self
Set request position offset.
Sourcepub fn with_reverse(self, reverse: bool) -> Self
pub fn with_reverse(self, reverse: bool) -> Self
Set the reverse state for options.
Sourcepub fn add_to_body(&self, body: &mut Value)
pub fn add_to_body(&self, body: &mut Value)
Add pagination options to a json Value.
Trait Implementations§
Source§impl Clone for HttpPaginationOptions
impl Clone for HttpPaginationOptions
Source§fn clone(&self) -> HttpPaginationOptions
fn clone(&self) -> HttpPaginationOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more