aboutsummaryrefslogtreecommitdiff
path: root/src/models/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/search.rs')
-rw-r--r--src/models/search.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/models/search.rs b/src/models/search.rs
index 3e5d782..22dab76 100644
--- a/src/models/search.rs
+++ b/src/models/search.rs
@@ -1,5 +1,5 @@
use crate::ids::{PageId, UserId};
-use crate::models::paging::Paging;
+use crate::models::paging::{Pageable, Paging};
use crate::models::Number;
use chrono::{DateTime, Utc};
use serde::ser::SerializeMap;
@@ -290,7 +290,7 @@ pub struct DatabaseSort {
pub direction: SortDirection,
}
-#[derive(Serialize, Debug, Eq, PartialEq, Default)]
+#[derive(Serialize, Debug, Eq, PartialEq, Default, Clone)]
pub struct DatabaseQuery {
#[serde(skip_serializing_if = "Option::is_none")]
pub sorts: Option<Vec<DatabaseSort>>,
@@ -300,6 +300,15 @@ pub struct DatabaseQuery {
pub paging: Option<Paging>,
}
+impl Pageable for DatabaseQuery {
+ fn start_from(self, starting_point: Paging) -> Self {
+ DatabaseQuery {
+ paging: Some(starting_point),
+ ..self
+ }
+ }
+}
+
#[derive(Debug, Eq, PartialEq)]
pub enum NotionSearch {
/// When supplied, limits which pages are returned by comparing the query to the page title.