Struct gitql_core::environment::Environment
source · pub struct Environment {
pub schema: Schema,
pub std_signatures: HashMap<&'static str, Signature>,
pub std_functions: HashMap<&'static str, Function>,
pub aggregation_signatures: HashMap<&'static str, Signature>,
pub aggregation_functions: HashMap<&'static str, Aggregation>,
pub globals: HashMap<String, Value>,
pub globals_types: HashMap<String, DataType>,
pub scopes: HashMap<String, DataType>,
}
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, Function>
Standard function references
aggregation_signatures: HashMap<&'static str, Signature>
Aggregation function signatures
aggregation_functions: HashMap<&'static str, Aggregation>
Aggregation function references
globals: HashMap<String, Value>
All Global Variables values that can life for this program session
globals_types: HashMap<String, DataType>
All Global Variables Types that can life for this program session
scopes: HashMap<String, DataType>
Local variables types in the current scope, later will be multi layer scopes
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, Function>
)
pub fn with_standard_functions( &mut self, signatures: &HashMap<&'static str, Signature>, functions: &HashMap<&'static str, Function> )
Register standard functions signatures and references
sourcepub fn with_aggregation_functions(
&mut self,
signatures: &HashMap<&'static str, Signature>,
aggregation: &HashMap<&'static str, Aggregation>
)
pub fn with_aggregation_functions( &mut self, signatures: &HashMap<&'static str, Signature>, aggregation: &HashMap<&'static str, Aggregation> )
Register aggregation functions signatures and references
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<&Function>
pub fn std_function(&self, str: &str) -> Option<&Function>
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<&Aggregation>
pub fn aggregation_function(&self, str: &str) -> Option<&Aggregation>
Return Aggregation function reference by name
sourcepub fn define_global(&mut self, str: String, data_type: DataType)
pub fn define_global(&mut self, str: String, data_type: 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<&DataType>
pub fn resolve_type(&self, str: &String) -> Option<&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