toasty_core/driver/operation/
query_pk.rs

1use super::Operation;
2use crate::{
3    schema::db::{ColumnId, IndexId, TableId},
4    stmt,
5};
6
7#[derive(Debug, Clone)]
8pub struct QueryPk {
9    /// Table to query
10    pub table: TableId,
11
12    /// Optional index to query. None = primary key, Some(id) = secondary index
13    pub index: Option<IndexId>,
14
15    /// Which columns to get
16    pub select: Vec<ColumnId>,
17
18    /// How to filter the index.
19    pub pk_filter: stmt::Expr,
20
21    /// Additional filtering done on the result before returning it to the
22    /// caller.
23    pub filter: Option<stmt::Expr>,
24
25    /// Maximum number of items to return. `None` means no limit.
26    pub limit: Option<i64>,
27
28    /// Sort key ordering direction for queries on a table with a composite
29    /// primary key. `None` uses the driver's default ordering.
30    pub order: Option<stmt::Direction>,
31
32    /// Cursor for resuming a paginated query. Contains the serialized key of
33    /// the last item from a previous page of results.
34    pub cursor: Option<stmt::Value>,
35}
36
37impl From<QueryPk> for Operation {
38    fn from(value: QueryPk) -> Self {
39        Self::QueryPk(value)
40    }
41}