gitql_core/schema.rs
1use std::collections::HashMap;
2
3use gitql_ast::types::DataType;
4
5/// A Representation of the Data Schema that constructed the following
6///
7/// [`tables_fields_names`] is a map of tables and columns names
8///
9/// # Examples
10///
11/// ```
12///
13/// pub static ref TABLES_FIELDS_NAMES: HashMap<&'static str, Vec<&'static str>> = {
14/// let mut map = HashMap::new();
15/// map.insert("refs", vec!["name", "full_name", "type", "repo"]);
16/// }
17///
18/// ```
19///
20/// [`tables_fields_types`] is a map of each column name in general with the expected data type
21///
22/// # Examples
23///
24/// ```
25/// pub static ref TABLES_FIELDS_TYPES: HashMap<&'static str, Box<dyn DataType>> = {
26/// let mut map = HashMap::new();
27/// map.insert("commit_id", Box::new(TextType));
28/// }
29/// ```
30///
31pub struct Schema {
32 pub tables_fields_names: HashMap<&'static str, Vec<&'static str>>,
33 pub tables_fields_types: HashMap<&'static str, Box<dyn DataType>>,
34}