const PAGINATION_LIMIT: usize = 100;
pub(crate) struct PaginationParams {
limit: usize,
offset: usize,
}
impl PaginationParams {
pub fn set_offset(&mut self, offset: usize) {
self.offset = offset
}
pub fn to_params(&self) -> Vec<(&str, String)> {
vec![
("limit", self.limit.to_string()),
("offset", self.offset.to_string()),
]
}
}
impl Default for PaginationParams {
fn default() -> Self {
Self {
limit: PAGINATION_LIMIT,
offset: 0,
}
}
}