Enum prql_compiler::sql::internal::SqlTransform
source · pub enum SqlTransform<Rel = RIId, Super = Transform> {
Show 13 variants
Super(Super),
From(Rel),
Select(Vec<CId>),
Filter(Expr),
Aggregate {
partition: Vec<CId>,
compute: Vec<CId>,
},
Sort(Vec<ColumnSort<CId>>),
Take(Take),
Join {
side: JoinSide,
with: Rel,
filter: Expr,
},
Distinct,
DistinctOn(Vec<CId>),
Except {
bottom: Rel,
distinct: bool,
},
Intersect {
bottom: Rel,
distinct: bool,
},
Union {
bottom: Rel,
distinct: bool,
},
}
Expand description
Similar to rq::Transform, but closer to a SQL clause.
Uses two generic args that allows the compiler to work in multiple stages:
- the first converts RQ to SqlTransform<RIId, rq::Transform>,
- the second compiles that to [SqlTransform<RelationExpr, ()>].
Variants§
Super(Super)
Contains rq::Transform during compilation. After finishing, this is emptied.
For example, initial an RQ Append transform is wrapped as such:
rq::Transform::Append(x) -> srq::SqlTransform::Super(rq::Transform::Append(x))
During preprocessing it is compiled to:
srq::SqlTransform::Super(rq::Transform::Append(_)) -> srq::SqlTransform::Union { .. }
At the end of SRQ compilation, all Super()
are either discarded or converted to their
SRQ equivalents.
From(Rel)
Select(Vec<CId>)
Filter(Expr)
Aggregate
Sort(Vec<ColumnSort<CId>>)
Take(Take)
Join
Distinct
DistinctOn(Vec<CId>)
Except
Intersect
Union
Implementations§
source§impl<Rel, Super> SqlTransform<Rel, Super>
impl<Rel, Super> SqlTransform<Rel, Super>
sourcepub fn as_super_mut(&mut self) -> Option<&mut Super>
pub fn as_super_mut(&mut self) -> Option<&mut Super>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Super
, otherwise None
sourcepub fn as_super(&self) -> Option<&Super>
pub fn as_super(&self) -> Option<&Super>
Optionally returns references to the inner fields if this is a SqlTransform::Super
, otherwise None
sourcepub fn into_super(self) -> Result<Super, SqlTransform<Rel, Super>>
pub fn into_super(self) -> Result<Super, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Super
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_from_mut(&mut self) -> Option<&mut Rel>
pub fn as_from_mut(&mut self) -> Option<&mut Rel>
Optionally returns mutable references to the inner fields if this is a SqlTransform::From
, otherwise None
sourcepub fn as_from(&self) -> Option<&Rel>
pub fn as_from(&self) -> Option<&Rel>
Optionally returns references to the inner fields if this is a SqlTransform::From
, otherwise None
sourcepub fn into_from(self) -> Result<Rel, SqlTransform<Rel, Super>>
pub fn into_from(self) -> Result<Rel, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::From
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_select(&self) -> bool
pub fn is_select(&self) -> bool
Returns true if this is a SqlTransform::Select
, otherwise false
sourcepub fn as_select_mut(&mut self) -> Option<&mut Vec<CId>>
pub fn as_select_mut(&mut self) -> Option<&mut Vec<CId>>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Select
, otherwise None
sourcepub fn as_select(&self) -> Option<&Vec<CId>>
pub fn as_select(&self) -> Option<&Vec<CId>>
Optionally returns references to the inner fields if this is a SqlTransform::Select
, otherwise None
sourcepub fn into_select(self) -> Result<Vec<CId>, SqlTransform<Rel, Super>>
pub fn into_select(self) -> Result<Vec<CId>, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Select
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_filter(&self) -> bool
pub fn is_filter(&self) -> bool
Returns true if this is a SqlTransform::Filter
, otherwise false
sourcepub fn as_filter_mut(&mut self) -> Option<&mut Expr>
pub fn as_filter_mut(&mut self) -> Option<&mut Expr>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Filter
, otherwise None
sourcepub fn as_filter(&self) -> Option<&Expr>
pub fn as_filter(&self) -> Option<&Expr>
Optionally returns references to the inner fields if this is a SqlTransform::Filter
, otherwise None
sourcepub fn into_filter(self) -> Result<Expr, SqlTransform<Rel, Super>>
pub fn into_filter(self) -> Result<Expr, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Filter
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_aggregate(&self) -> bool
pub fn is_aggregate(&self) -> bool
Returns true if this is a SqlTransform::Aggregate
, otherwise false
sourcepub fn as_aggregate_mut(&mut self) -> Option<(&mut Vec<CId>, &mut Vec<CId>)>
pub fn as_aggregate_mut(&mut self) -> Option<(&mut Vec<CId>, &mut Vec<CId>)>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Aggregate
, otherwise None
sourcepub fn as_aggregate(&self) -> Option<(&Vec<CId>, &Vec<CId>)>
pub fn as_aggregate(&self) -> Option<(&Vec<CId>, &Vec<CId>)>
Optionally returns references to the inner fields if this is a SqlTransform::Aggregate
, otherwise None
sourcepub fn into_aggregate(
self
) -> Result<(Vec<CId>, Vec<CId>), SqlTransform<Rel, Super>>
pub fn into_aggregate( self ) -> Result<(Vec<CId>, Vec<CId>), SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Aggregate
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_sort_mut(&mut self) -> Option<&mut Vec<ColumnSort<CId>>>
pub fn as_sort_mut(&mut self) -> Option<&mut Vec<ColumnSort<CId>>>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Sort
, otherwise None
sourcepub fn as_sort(&self) -> Option<&Vec<ColumnSort<CId>>>
pub fn as_sort(&self) -> Option<&Vec<ColumnSort<CId>>>
Optionally returns references to the inner fields if this is a SqlTransform::Sort
, otherwise None
sourcepub fn into_sort(self) -> Result<Vec<ColumnSort<CId>>, SqlTransform<Rel, Super>>
pub fn into_sort(self) -> Result<Vec<ColumnSort<CId>>, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Sort
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_take_mut(&mut self) -> Option<&mut Take>
pub fn as_take_mut(&mut self) -> Option<&mut Take>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Take
, otherwise None
sourcepub fn as_take(&self) -> Option<&Take>
pub fn as_take(&self) -> Option<&Take>
Optionally returns references to the inner fields if this is a SqlTransform::Take
, otherwise None
sourcepub fn into_take(self) -> Result<Take, SqlTransform<Rel, Super>>
pub fn into_take(self) -> Result<Take, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Take
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_join_mut(&mut self) -> Option<(&mut JoinSide, &mut Rel, &mut Expr)>
pub fn as_join_mut(&mut self) -> Option<(&mut JoinSide, &mut Rel, &mut Expr)>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Join
, otherwise None
sourcepub fn as_join(&self) -> Option<(&JoinSide, &Rel, &Expr)>
pub fn as_join(&self) -> Option<(&JoinSide, &Rel, &Expr)>
Optionally returns references to the inner fields if this is a SqlTransform::Join
, otherwise None
sourcepub fn into_join(
self
) -> Result<(JoinSide, Rel, Expr), SqlTransform<Rel, Super>>
pub fn into_join( self ) -> Result<(JoinSide, Rel, Expr), SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Join
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_distinct(&self) -> bool
pub fn is_distinct(&self) -> bool
Returns true if this is a SqlTransform::Distinct
, otherwise false
sourcepub fn is_distinct_on(&self) -> bool
pub fn is_distinct_on(&self) -> bool
Returns true if this is a SqlTransform::DistinctOn
, otherwise false
sourcepub fn as_distinct_on_mut(&mut self) -> Option<&mut Vec<CId>>
pub fn as_distinct_on_mut(&mut self) -> Option<&mut Vec<CId>>
Optionally returns mutable references to the inner fields if this is a SqlTransform::DistinctOn
, otherwise None
sourcepub fn as_distinct_on(&self) -> Option<&Vec<CId>>
pub fn as_distinct_on(&self) -> Option<&Vec<CId>>
Optionally returns references to the inner fields if this is a SqlTransform::DistinctOn
, otherwise None
sourcepub fn into_distinct_on(self) -> Result<Vec<CId>, SqlTransform<Rel, Super>>
pub fn into_distinct_on(self) -> Result<Vec<CId>, SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::DistinctOn
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_except(&self) -> bool
pub fn is_except(&self) -> bool
Returns true if this is a SqlTransform::Except
, otherwise false
sourcepub fn as_except_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
pub fn as_except_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Except
, otherwise None
sourcepub fn as_except(&self) -> Option<(&Rel, &bool)>
pub fn as_except(&self) -> Option<(&Rel, &bool)>
Optionally returns references to the inner fields if this is a SqlTransform::Except
, otherwise None
sourcepub fn into_except(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
pub fn into_except(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Except
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_intersect(&self) -> bool
pub fn is_intersect(&self) -> bool
Returns true if this is a SqlTransform::Intersect
, otherwise false
sourcepub fn as_intersect_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
pub fn as_intersect_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Intersect
, otherwise None
sourcepub fn as_intersect(&self) -> Option<(&Rel, &bool)>
pub fn as_intersect(&self) -> Option<(&Rel, &bool)>
Optionally returns references to the inner fields if this is a SqlTransform::Intersect
, otherwise None
sourcepub fn into_intersect(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
pub fn into_intersect(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Intersect
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_union_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
pub fn as_union_mut(&mut self) -> Option<(&mut Rel, &mut bool)>
Optionally returns mutable references to the inner fields if this is a SqlTransform::Union
, otherwise None
sourcepub fn as_union(&self) -> Option<(&Rel, &bool)>
pub fn as_union(&self) -> Option<(&Rel, &bool)>
Optionally returns references to the inner fields if this is a SqlTransform::Union
, otherwise None
sourcepub fn into_union(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
pub fn into_union(self) -> Result<(Rel, bool), SqlTransform<Rel, Super>>
Returns the inner fields if this is a SqlTransform::Union
, otherwise returns back the enum in the Err
case of the result
source§impl<Rel> SqlTransform<Rel>
impl<Rel> SqlTransform<Rel>
Trait Implementations§
source§impl<Rel, Super> AsRef<str> for SqlTransform<Rel, Super>
impl<Rel, Super> AsRef<str> for SqlTransform<Rel, Super>
source§impl<Rel, Super> Clone for SqlTransform<Rel, Super>
impl<Rel, Super> Clone for SqlTransform<Rel, Super>
source§fn clone(&self) -> SqlTransform<Rel, Super>
fn clone(&self) -> SqlTransform<Rel, Super>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more