pub struct NormalizedSelect {
pub table: String,
pub columns: Vec<Expr>,
pub joins: Vec<NormalizedJoin>,
pub filters: Vec<FilterClause>,
pub order_by: Vec<OrderByItem>,
pub limit: Option<usize>,
pub offset: Option<usize>,
}Expand description
Canonical representation for the rewrite-safe subset of SELECT.
Fields§
§table: String§columns: Vec<Expr>§joins: Vec<NormalizedJoin>§filters: Vec<FilterClause>§order_by: Vec<OrderByItem>§limit: Option<usize>§offset: Option<usize>Implementations§
Source§impl NormalizedSelect
impl NormalizedSelect
Sourcepub fn cleaned(&self) -> Self
pub fn cleaned(&self) -> Self
Apply a deterministic cleanup rewrite that preserves the supported-subset semantics.
Cleanup rules:
- merge all
ANDfilter clauses into one clause - merge all
ORfilter clauses into one clause - remove empty filter clauses
- sort and dedupe conditions in filter and join ON clauses
- dedupe repeated ORDER BY items while preserving the first occurrence
Sourcepub fn canonicalized(&self) -> Self
pub fn canonicalized(&self) -> Self
Return a canonicalized clone for structural comparison.
This only reorders semantically commutative components:
- condition order within a filter clause
- condition order within a join
ONconjunction
It intentionally preserves the order of:
- projection columns
- joins
- filter clauses
- ORDER BY items
Sourcepub fn equivalent_shape(&self, other: &Self) -> bool
pub fn equivalent_shape(&self, other: &Self) -> bool
Compare two normalized queries under the supported-subset semantics.
Trait Implementations§
Source§impl Clone for NormalizedSelect
impl Clone for NormalizedSelect
Source§fn clone(&self) -> NormalizedSelect
fn clone(&self) -> NormalizedSelect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NormalizedSelect
impl Debug for NormalizedSelect
Source§impl PartialEq for NormalizedSelect
impl PartialEq for NormalizedSelect
Source§impl TryFrom<&Qail> for NormalizedSelect
impl TryFrom<&Qail> for NormalizedSelect
impl StructuralPartialEq for NormalizedSelect
Auto Trait Implementations§
impl Freeze for NormalizedSelect
impl RefUnwindSafe for NormalizedSelect
impl Send for NormalizedSelect
impl Sync for NormalizedSelect
impl Unpin for NormalizedSelect
impl UnsafeUnpin for NormalizedSelect
impl UnwindSafe for NormalizedSelect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more