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<QueryPkLimit>,
pub order: Option<Direction>,
}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: None,
order: 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<QueryPkLimit>Limit and pagination bounds for this query. None means unbounded.
order: Option<Direction>Sort key ordering direction for tables with a composite primary key.
None uses the driver’s default ordering.