pub struct QueryPk {
pub table: TableId,
pub index: Option<IndexId>,
pub select: Vec<ColumnId>,
pub pk_filter: Expr,
pub filter: Option<Expr>,
pub limit: Option<i64>,
pub order: Option<Direction>,
pub cursor: Option<Value>,
}Expand description
Queries a table by primary key (or secondary index) with optional filtering, ordering, and pagination.
This is the primary read operation for key-value drivers. The driver applies
pk_filter against the index, then applies the optional post-filter, and
returns up to limit rows in the requested order.
§Examples
use toasty_core::driver::operation::{QueryPk, Operation};
let op = QueryPk {
table: table_id,
index: None, // query the primary key
select: vec![col_a, col_b],
pk_filter: pk_expr,
filter: None,
limit: Some(10),
order: None,
cursor: None,
};
let operation: Operation = op.into();Fields§
§table: TableIdThe table to query.
index: Option<IndexId>Index to query. None means the primary key; Some(id) means a
secondary index.
select: Vec<ColumnId>Which columns to include in the returned rows.
pk_filter: ExprFilter expression applied against the index key columns.
filter: Option<Expr>Optional post-filter applied to rows after the index scan, before returning results to the caller.
limit: Option<i64>Maximum number of rows to return. None means no limit.
order: Option<Direction>Sort key ordering direction for tables with a composite primary key.
None uses the driver’s default ordering.
cursor: Option<Value>Pagination cursor. Contains the serialized key of the last item from a previous page of results. When set, the query resumes after this key.