diff options
author | 2021-09-22 14:13:05 -0700 | |
---|---|---|
committer | 2021-09-22 14:13:05 -0700 | |
commit | f34ba4d79682665603d5ce3192b5422aab3f6800 (patch) | |
tree | d2bded634af25a2bfe7e5ab817b14a5759e0f5ef /src/models/search.rs | |
parent | 50faf778671358d70fa967735a062b4a6b6dfe64 (diff) | |
download | notion-f34ba4d79682665603d5ce3192b5422aab3f6800.tar.gz notion-f34ba4d79682665603d5ce3192b5422aab3f6800.tar.zst notion-f34ba4d79682665603d5ce3192b5422aab3f6800.zip |
feat: Paging improvements and ergonomics
Diffstat (limited to 'src/models/search.rs')
-rw-r--r-- | src/models/search.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/models/search.rs b/src/models/search.rs index 22dab76..e7d8189 100644 --- a/src/models/search.rs +++ b/src/models/search.rs @@ -1,5 +1,5 @@ use crate::ids::{PageId, UserId}; -use crate::models::paging::{Pageable, Paging}; +use crate::models::paging::{Pageable, Paging, PagingCursor}; use crate::models::Number; use chrono::{DateTime, Utc}; use serde::ser::SerializeMap; @@ -301,9 +301,12 @@ pub struct DatabaseQuery { } impl Pageable for DatabaseQuery { - fn start_from(self, starting_point: Paging) -> Self { + fn start_from(self, starting_point: Option<PagingCursor>) -> Self { DatabaseQuery { - paging: Some(starting_point), + paging: Some(Paging { + start_cursor: starting_point, + page_size: self.paging.and_then(|p| p.page_size), + }), ..self } } |