Skip to main content

toasty_core/driver/operation/
scan.rs

1use super::{Operation, Pagination};
2use crate::{schema::db::TableId, stmt};
3
4/// A full-table scan operation.
5///
6/// Sent to drivers that set [`Capability::scan`](crate::driver::Capability::scan) to `true`
7/// (currently only DynamoDB). The driver scans the entire table and applies
8/// `filter` to each row before returning results.
9#[derive(Debug, Clone)]
10pub struct Scan {
11    /// Table to scan.
12    pub table: TableId,
13
14    /// Column indices to return (relative to the table's column list).
15    pub columns: Vec<usize>,
16
17    /// Optional filter expression applied to each row after scanning.
18    pub filter: Option<stmt::Expr>,
19
20    /// Limit and pagination bounds. `None` means return all rows.
21    ///
22    /// - `Cursor` for keyset/cursor-based pagination (`.paginate()`)
23    /// - `Offset` for hard-limit with optional skip (`.limit()` / `.offset()`)
24    pub limit: Option<Pagination>,
25}
26
27impl From<Scan> for Operation {
28    fn from(value: Scan) -> Self {
29        Self::Scan(value)
30    }
31}