pub struct QueryRequest {
pub columns: Vec<String>,
pub predicates: Vec<Predicate>,
pub group_by: Vec<String>,
pub aggregations: Vec<Aggregation>,
pub distinct: bool,
pub order_by: Vec<OrderBy>,
pub limit: Option<u64>,
pub page: u64,
pub page_size: u64,
}Fields§
§columns: Vec<String>Columns to return. Empty = all columns. Ignored when group_by is
non-empty (the SELECT list is then derived from group_by + aggregations).
predicates: Vec<Predicate>§group_by: Vec<String>Group-by columns. Empty = no grouping (regular row scan). When set,
the response shape is { group_col_1, …, alias_1, … } per row.
aggregations: Vec<Aggregation>Aggregations to compute over each group. When group_by is set and
this is empty, an implicit { op: "count" } is added.
distinct: boolReturn only distinct rows over the projected columns. Mutually
exclusive with group_by / aggregations.
order_by: Vec<OrderBy>Sort spec. Empty = unsorted (engine order).
limit: Option<u64>Hard cap on total rows returned across all pages. None = no cap
beyond page_size.
page: u64§page_size: u64Implementations§
Source§impl QueryRequest
impl QueryRequest
Sourcepub fn agg_plan(
&self,
schema: &DatasetSchema,
) -> Result<Option<AggPlan>, AppError>
pub fn agg_plan( &self, schema: &DatasetSchema, ) -> Result<Option<AggPlan>, AppError>
Resolve the group_by + aggregations request into a validated
plan, or return Ok(None) when no grouping was requested.
When group_by is non-empty and aggregations is empty, an
implicit COUNT(*) AS count is added so the plan always has at
least one output value.
Sourcepub fn order_by_sql(
&self,
schema: &DatasetSchema,
plan: Option<&AggPlan>,
) -> Result<Option<String>, AppError>
pub fn order_by_sql( &self, schema: &DatasetSchema, plan: Option<&AggPlan>, ) -> Result<Option<String>, AppError>
Translate order_by into a validated SQL fragment, e.g.
"\"a\" ASC, \"b\" DESC". Returns Ok(None) if no ordering was
requested.
When plan is Some, sort keys must reference a group-by column
or an aggregation alias (the only names in scope after GROUP BY).
When plan is None, sort keys are validated against the dataset
schema.
Sourcepub fn effective_limit_offset(&self, page_size_cap: u64) -> (u64, u64)
pub fn effective_limit_offset(&self, page_size_cap: u64) -> (u64, u64)
Compute the effective SQL LIMIT and OFFSET for this request,
honouring both page/page_size and the optional top-level limit
cap. page_size_cap is the per-page maximum the backend enforces.
Semantics: pagination still drives offset; limit caps the total
number of rows ever returned across all pages. Once offset >= limit, the effective LIMIT is 0 (empty page).
Trait Implementations§
Source§impl Clone for QueryRequest
impl Clone for QueryRequest
Source§fn clone(&self) -> QueryRequest
fn clone(&self) -> QueryRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more