pub struct SelectBuilder { /* private fields */ }unparser only.Implementations§
Source§impl SelectBuilder
impl SelectBuilder
Sourcepub fn next_flatten_alias(&mut self) -> String
pub fn next_flatten_alias(&mut self) -> String
Generate a unique alias for a LATERAL FLATTEN relation
(_unnest_1, _unnest_2, …). Each call returns a fresh name.
Sourcepub fn add_flatten_table_alias(&mut self, alias: String)
pub fn add_flatten_table_alias(&mut self, alias: String)
Register a table alias as pointing to a LATERAL FLATTEN relation.
Sourcepub fn flatten_table_aliases_empty(&self) -> bool
pub fn flatten_table_aliases_empty(&self) -> bool
Returns true if no FLATTEN table aliases have been registered.
Sourcepub fn is_flatten_table_alias(&self, alias: &str) -> bool
pub fn is_flatten_table_alias(&self, alias: &str) -> bool
Returns true if the given table alias refers to a FLATTEN relation.
Sourcepub fn current_flatten_alias(&self) -> Option<String>
pub fn current_flatten_alias(&self) -> Option<String>
Returns the most recently generated flatten alias, or None if
next_flatten_alias has not been called yet.
pub fn distinct(&mut self, value: Option<Distinct>) -> &mut Self
pub fn top(&mut self, value: Option<Top>) -> &mut Self
pub fn projection(&mut self, value: Vec<SelectItem>) -> &mut Self
pub fn pop_projections(&mut self) -> Vec<SelectItem>
Sourcepub fn already_projected(&self) -> bool
pub fn already_projected(&self) -> bool
Returns true if a projection has been explicitly set via projection().
This method is used to determine whether the SELECT clause has already been
defined, which helps avoid creating duplicate projection nodes during query
unparsing. It returns true for both empty and non-empty projections.
§Returns
trueifprojection()has been called (regardless of whether it was empty or not)falseif no projection has been set yet
§Example
let mut builder = SelectBuilder::default();
assert!(!builder.already_projected());
builder.projection(vec![]);
assert!(builder.already_projected()); // true even for empty projection
builder.projection(vec![SelectItem::Wildcard(...)]);
assert!(builder.already_projected()); // true for non-empty projectionpub fn into(&mut self, value: Option<SelectInto>) -> &mut Self
pub fn from(&mut self, value: Vec<TableWithJoinsBuilder>) -> &mut Self
pub fn push_from(&mut self, value: TableWithJoinsBuilder) -> &mut Self
pub fn pop_from(&mut self) -> Option<TableWithJoinsBuilder>
pub fn lateral_views(&mut self, value: Vec<LateralView>) -> &mut Self
Sourcepub fn replace_mark(&mut self, existing_expr: &Expr, value: &Expr) -> &mut Self
pub fn replace_mark(&mut self, existing_expr: &Expr, value: &Expr) -> &mut Self
Replaces the selection with a new value.
This function is used to replace a specific expression within the selection.
Unlike the selection method which combines existing and new selections with AND,
this method searches for and replaces occurrences of a specific expression.
This method is primarily used to modify LEFT MARK JOIN expressions. When processing a LEFT MARK JOIN, we need to replace the placeholder expression with the actual join condition in the selection clause.
§Arguments
existing_expr- The expression to replacevalue- The new expression to set as the selection
pub fn selection(&mut self, value: Option<Expr>) -> &mut Self
pub fn group_by(&mut self, value: GroupByExpr) -> &mut Self
pub fn cluster_by(&mut self, value: Vec<Expr>) -> &mut Self
pub fn distribute_by(&mut self, value: Vec<Expr>) -> &mut Self
pub fn sort_by(&mut self, value: Vec<OrderByExpr>) -> &mut Self
pub fn having(&mut self, value: Option<Expr>) -> &mut Self
pub fn named_window(&mut self, value: Vec<NamedWindowDefinition>) -> &mut Self
pub fn qualify(&mut self, value: Option<Expr>) -> &mut Self
pub fn value_table_mode(&mut self, value: Option<ValueTableMode>) -> &mut Self
pub fn build(&self) -> Result<Select, BuilderError>
Trait Implementations§
Source§impl Clone for SelectBuilder
impl Clone for SelectBuilder
Source§fn clone(&self) -> SelectBuilder
fn clone(&self) -> SelectBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SelectBuilder
impl RefUnwindSafe for SelectBuilder
impl Send for SelectBuilder
impl Sync for SelectBuilder
impl Unpin for SelectBuilder
impl UnsafeUnpin for SelectBuilder
impl UnwindSafe for SelectBuilder
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more