Skip to main content

toasty_core/stmt/
offset.rs

1use super::Expr;
2
3/// An offset specifying where a [`Limit`](super::Limit) starts reading rows.
4///
5/// Supports two strategies: count-based (`OFFSET n`) and keyset-based (start
6/// after a given cursor value).
7///
8/// # Examples
9///
10/// ```ignore
11/// use toasty_core::stmt::{Offset, Expr, Value};
12///
13/// let offset = Offset::Count(Expr::from(Value::from(5_i64)));
14/// ```
15#[derive(Debug, Clone, PartialEq)]
16pub enum Offset {
17    /// Keyset-based offset: start after the row matching this expression.
18    After(Expr),
19
20    /// Count-based offset: skip this many rows (`OFFSET n`).
21    Count(Expr),
22}