#[cfg(feature = "sql")]
pub mod sql;
pub mod cursor;
pub mod keyset;
pub mod offset;
pub use cursor::{Cursor, CursorPage, CursorPageRequest};
pub use keyset::{KeysetPage, KeysetPageRequest, KeysetPosition};
pub use offset::{OffsetPageRequest, Page};
use serde::{Deserialize, Serialize};
pub const DEFAULT_PAGE_SIZE: u32 = 20;
pub const MAX_PAGE_SIZE: u32 = 100;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum SortOrder {
#[default]
Asc,
Desc,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SortKey {
pub field: String,
pub order: SortOrder,
}
impl SortKey {
pub fn asc(field: impl Into<String>) -> Self {
SortKey { field: field.into(), order: SortOrder::Asc }
}
pub fn desc(field: impl Into<String>) -> Self {
SortKey { field: field.into(), order: SortOrder::Desc }
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum KeysetDialect {
Positional,
Question,
}