1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use lazy_static::lazy_static;
use std::collections::HashMap;

#[derive(PartialEq, Clone)]
pub enum DataType {
    Any,
    Text,
    Number,
    Boolean,
    Date,
}

impl DataType {
    pub fn literal(&self) -> &'static str {
        return match self {
            DataType::Any => "Any",
            DataType::Text => "Text",
            DataType::Number => "Number",
            DataType::Boolean => "Boolean",
            DataType::Date => "Date",
        };
    }
}

lazy_static! {
    pub static ref TABLES_FIELDS_TYPES: HashMap<&'static str, DataType> = {
        let mut map = HashMap::new();
        map.insert("commit_id", DataType::Text);
        map.insert("title", DataType::Text);
        map.insert("message", DataType::Text);
        map.insert("name", DataType::Text);
        map.insert("full_name", DataType::Text);
        map.insert("insertions", DataType::Number);
        map.insert("deletions", DataType::Number);
        map.insert("files_changed", DataType::Number);
        map.insert("email", DataType::Text);
        map.insert("type", DataType::Text);
        map.insert("time", DataType::Date);
        map.insert("is_head", DataType::Boolean);
        map.insert("is_remote", DataType::Boolean);
        map.insert("commit_count", DataType::Number);
        map
    };
}