toasty_core/driver/operation/pagination.rs
1use crate::stmt;
2
3/// Describes how results from a paged operation should be bounded.
4///
5/// Used by both [`QueryPk`](super::QueryPk) and [`Scan`](super::Scan).
6#[derive(Debug, Clone)]
7pub enum Pagination {
8 /// Cursor-based (keyset) pagination. Returns `page_size` items resuming
9 /// after `after`. `after = None` means the first page.
10 Cursor {
11 /// Maximum number of items to return per page.
12 page_size: i64,
13 /// Serialized key of the last item from the previous page, or `None`
14 /// for the first page.
15 after: Option<stmt::Value>,
16 },
17 /// Hard-limit with optional client-side skip. Returns up to `limit` items
18 /// after discarding the first `offset`.
19 Offset {
20 /// Maximum number of items to return.
21 limit: i64,
22 /// Number of leading items to skip before returning results.
23 offset: Option<i64>,
24 },
25}