pub struct Query {
pub from_source: Option<Source>,
pub select_columns: Vec<String>,
pub joins: Vec<JoinClause>,
pub where_clause: Option<String>,
pub group_by: Vec<String>,
pub having_clause: Option<String>,
pub order_by: Vec<String>,
pub limit: Option<usize>,
pub offset: Option<usize>,
pub index_optimizer: Option<IndexOptimizer>,
}Expand description
Main query builder for Ignis
Fields§
§from_source: Option<Source>§select_columns: Vec<String>§joins: Vec<JoinClause>§where_clause: Option<String>§group_by: Vec<String>§having_clause: Option<String>§order_by: Vec<String>§limit: Option<usize>§offset: Option<usize>§index_optimizer: Option<IndexOptimizer>Implementations§
Source§impl Query
impl Query
Sourcepub fn from_table(self, table: Table) -> Self
pub fn from_table(self, table: Table) -> Self
Set the table to query from (convenience method)
Sourcepub fn from_table_name(self, table_name: impl Into<String>) -> Self
pub fn from_table_name(self, table_name: impl Into<String>) -> Self
Set the table to query from using table name (convenience method)
Sourcepub fn call_procedure(self, procedure: StoredProcedure) -> Self
pub fn call_procedure(self, procedure: StoredProcedure) -> Self
Call a stored procedure (convenience method)
Sourcepub fn call_function(self, function: StoredFunction) -> Self
pub fn call_function(self, function: StoredFunction) -> Self
Call a stored function (convenience method)
Sourcepub fn select_columns(self, columns: Vec<String>) -> Self
pub fn select_columns(self, columns: Vec<String>) -> Self
Add columns to select
Sourcepub fn select_columns_str(self, columns: &[&str]) -> Self
pub fn select_columns_str(self, columns: &[&str]) -> Self
Add columns to select (convenience method for &&str)
Sourcepub fn filter_composite_field(self, field_ref: CompositeFieldRef) -> Self
pub fn filter_composite_field(self, field_ref: CompositeFieldRef) -> Self
Add composite field filter to WHERE clause
Sourcepub fn or_filter_composite_field(self, field_ref: CompositeFieldRef) -> Self
pub fn or_filter_composite_field(self, field_ref: CompositeFieldRef) -> Self
Add composite field filter with OR logic
Sourcepub fn order_by_composite_field<T>(self, field: CompositeField<T>) -> Self
pub fn order_by_composite_field<T>(self, field: CompositeField<T>) -> Self
Add ORDER BY clause using composite field
Sourcepub fn select_composite_field<T>(
self,
field: CompositeField<T>,
alias: Option<String>,
) -> Self
pub fn select_composite_field<T>( self, field: CompositeField<T>, alias: Option<String>, ) -> Self
Add composite field to SELECT clause
Sourcepub fn inner_join(self, target: Source, condition: impl Into<String>) -> Self
pub fn inner_join(self, target: Source, condition: impl Into<String>) -> Self
Add an INNER JOIN
Sourcepub fn right_join(self, target: Source, condition: impl Into<String>) -> Self
pub fn right_join(self, target: Source, condition: impl Into<String>) -> Self
Add a RIGHT JOIN
Sourcepub fn full_join(self, target: Source, condition: impl Into<String>) -> Self
pub fn full_join(self, target: Source, condition: impl Into<String>) -> Self
Add a FULL OUTER JOIN
Sourcepub fn inner_join_table(
self,
table: Table,
condition: impl Into<String>,
) -> Self
pub fn inner_join_table( self, table: Table, condition: impl Into<String>, ) -> Self
Add a JOIN using table (convenience method)
Sourcepub fn inner_join_table_name(
self,
table_name: impl Into<String>,
condition: impl Into<String>,
) -> Self
pub fn inner_join_table_name( self, table_name: impl Into<String>, condition: impl Into<String>, ) -> Self
Add an INNER JOIN using table name (convenience method)
Sourcepub fn left_join_table_name(
self,
table_name: impl Into<String>,
condition: impl Into<String>,
) -> Self
pub fn left_join_table_name( self, table_name: impl Into<String>, condition: impl Into<String>, ) -> Self
Add a LEFT JOIN using table name (convenience method)
Sourcepub fn right_join_table_name(
self,
table_name: impl Into<String>,
condition: impl Into<String>,
) -> Self
pub fn right_join_table_name( self, table_name: impl Into<String>, condition: impl Into<String>, ) -> Self
Add a RIGHT JOIN using table name (convenience method)
Sourcepub fn select(self, expression: impl Into<String>) -> Self
pub fn select(self, expression: impl Into<String>) -> Self
Add a SELECT with aggregation function
Sourcepub fn with_indexes(self, indexes: Vec<IndexMeta>) -> Self
pub fn with_indexes(self, indexes: Vec<IndexMeta>) -> Self
Enable index-aware query optimization
Sourcepub fn get_index_hints(&self) -> Option<String>
pub fn get_index_hints(&self) -> Option<String>
Get index optimization hints for this query
Sourcepub fn is_materialized_view(&self) -> bool
pub fn is_materialized_view(&self) -> bool
Check if this query is against a materialized view
Sourcepub fn generate_refresh_sql(&self) -> Option<String>
pub fn generate_refresh_sql(&self) -> Option<String>
Generate refresh SQL for materialized views
Sourcepub fn is_procedure_call(&self) -> bool
pub fn is_procedure_call(&self) -> bool
Check if this query is a procedure or function call
Sourcepub fn generate_call_sql(&self, parameters: Vec<String>) -> String
pub fn generate_call_sql(&self, parameters: Vec<String>) -> String
Generate CALL statement for procedures or SELECT statement for functions
Sourcepub fn to_sql(&self) -> String
pub fn to_sql(&self) -> String
Generate the SQL for this query with thread-safe caching for performance
Sourcepub fn cache_stats() -> (usize, usize)
pub fn cache_stats() -> (usize, usize)
Get cache statistics for monitoring
Sourcepub fn init_cache()
pub fn init_cache()
Initialize the query cache (call once at startup)
Sourcepub fn generate_all_sql(&self) -> Vec<String>
pub fn generate_all_sql(&self) -> Vec<String>
Generate all SQL statements for this query (including refresh for materialized views)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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