pub struct Environment {
pub schema: Schema,
pub std_signatures: HashMap<&'static str, Signature>,
pub std_functions: HashMap<&'static str, StandardFunction>,
pub aggregation_signatures: HashMap<&'static str, Signature>,
pub aggregation_functions: HashMap<&'static str, AggregationFunction>,
pub window_signatures: HashMap<&'static str, Signature>,
pub window_functions: HashMap<&'static str, WindowFunction>,
pub globals: HashMap<String, Box<dyn Value>>,
pub globals_types: HashMap<String, Box<dyn DataType>>,
pub scopes: HashMap<String, Box<dyn DataType>>,
pub types_table: TypesTable,
}
Expand description
Environment that track schema, functions, scopes and types to be used in different places in the query engine
Fields§
§schema: Schema
Data schema information contains table, fields names and types
std_signatures: HashMap<&'static str, Signature>
Standard function signatures
std_functions: HashMap<&'static str, StandardFunction>
Standard function references
aggregation_signatures: HashMap<&'static str, Signature>
Aggregation function signatures
aggregation_functions: HashMap<&'static str, AggregationFunction>
Aggregation function references
window_signatures: HashMap<&'static str, Signature>
Window function signatures
window_functions: HashMap<&'static str, WindowFunction>
Window function references
globals: HashMap<String, Box<dyn Value>>
All Global Variables values that can life for this program session
globals_types: HashMap<String, Box<dyn DataType>>
All Global Variables Types that can life for this program session
scopes: HashMap<String, Box<dyn DataType>>
Local variables types in the current scope, later will be multi layer scopes
types_table: TypesTable
A Table of DataTypes mapped to their original names or aliases
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn new(schema: Schema) -> Self
pub fn new(schema: Schema) -> Self
Create new Environment
instance with Data Schema
Sourcepub fn with_standard_functions(
&mut self,
signatures: &HashMap<&'static str, Signature>,
functions: &HashMap<&'static str, StandardFunction>,
)
pub fn with_standard_functions( &mut self, signatures: &HashMap<&'static str, Signature>, functions: &HashMap<&'static str, StandardFunction>, )
Register standard functions signatures and references
Sourcepub fn with_aggregation_functions(
&mut self,
signatures: &HashMap<&'static str, Signature>,
aggregation: &HashMap<&'static str, AggregationFunction>,
)
pub fn with_aggregation_functions( &mut self, signatures: &HashMap<&'static str, Signature>, aggregation: &HashMap<&'static str, AggregationFunction>, )
Register aggregation functions signatures and references
Sourcepub fn with_window_functions(
&mut self,
signatures: &HashMap<&'static str, Signature>,
window: &HashMap<&'static str, WindowFunction>,
)
pub fn with_window_functions( &mut self, signatures: &HashMap<&'static str, Signature>, window: &HashMap<&'static str, WindowFunction>, )
Register Window functions signatures and references
Sourcepub fn with_types_table(&mut self, types_table: TypesTable)
pub fn with_types_table(&mut self, types_table: TypesTable)
Register new Modified Types table
Sourcepub fn is_std_function(&self, str: &str) -> bool
pub fn is_std_function(&self, str: &str) -> bool
Return true if this name is a valid standard function
Sourcepub fn std_signature(&self, str: &str) -> Option<&Signature>
pub fn std_signature(&self, str: &str) -> Option<&Signature>
Return Standard function signature by name
Sourcepub fn std_function(&self, str: &str) -> Option<&StandardFunction>
pub fn std_function(&self, str: &str) -> Option<&StandardFunction>
Return Standard function reference by name
Sourcepub fn is_aggregation_function(&self, str: &str) -> bool
pub fn is_aggregation_function(&self, str: &str) -> bool
Return true if this name is a valid aggregation function
Sourcepub fn aggregation_signature(&self, str: &str) -> Option<&Signature>
pub fn aggregation_signature(&self, str: &str) -> Option<&Signature>
Return Aggregation function signature by name
Sourcepub fn aggregation_function(&self, str: &str) -> Option<&AggregationFunction>
pub fn aggregation_function(&self, str: &str) -> Option<&AggregationFunction>
Return Aggregation function reference by name
Sourcepub fn is_window_function(&self, str: &str) -> bool
pub fn is_window_function(&self, str: &str) -> bool
Return true if this name is a valid Window function
Sourcepub fn window_function_signature(&self, str: &str) -> Option<&Signature>
pub fn window_function_signature(&self, str: &str) -> Option<&Signature>
Return Window function signature by name
Sourcepub fn window_function(&self, str: &str) -> Option<&WindowFunction>
pub fn window_function(&self, str: &str) -> Option<&WindowFunction>
Return Window function reference by name
Sourcepub fn define(&mut self, str: String, data_type: Box<dyn DataType>)
pub fn define(&mut self, str: String, data_type: Box<dyn DataType>)
Define in the current scope
Sourcepub fn define_global(&mut self, str: String, data_type: Box<dyn DataType>)
pub fn define_global(&mut self, str: String, data_type: Box<dyn DataType>)
Define in the global scope
Sourcepub fn contains(&self, str: &String) -> bool
pub fn contains(&self, str: &String) -> bool
Returns true if local or global scopes has contains field
Sourcepub fn resolve_type(&self, str: &String) -> Option<&Box<dyn DataType>>
pub fn resolve_type(&self, str: &String) -> Option<&Box<dyn DataType>>
Resolve Global or Local type using symbol name
Sourcepub fn clear_session(&mut self)
pub fn clear_session(&mut self)
Clear all locals scopes and only save globals