@@ -14,16 +14,12 @@ use gitql_cli::printer::csv_printer::CSVPrinter;
14
14
use gitql_cli:: printer:: json_printer:: JSONPrinter ;
15
15
use gitql_cli:: printer:: table_printer:: TablePrinter ;
16
16
use gitql_core:: environment:: Environment ;
17
- use gitql_core:: schema:: Schema ;
18
17
use gitql_engine:: data_provider:: DataProvider ;
19
18
use gitql_engine:: engine;
20
19
use gitql_parser:: diagnostic:: Diagnostic ;
21
20
use gitql_parser:: parser;
22
21
use gitql_parser:: tokenizer:: Tokenizer ;
23
- use gitql_std:: aggregation:: aggregation_function_signatures;
24
- use gitql_std:: aggregation:: aggregation_functions;
25
- use schema:: tables_fields_names;
26
- use schema:: tables_fields_types;
22
+ use schema:: create_fileql_environment;
27
23
28
24
mod arguments;
29
25
mod data_provider;
@@ -47,21 +43,8 @@ fn main() {
47
43
reporter. report_diagnostic ( "" , Diagnostic :: error ( error. as_str ( ) ) ) ;
48
44
return ;
49
45
}
50
- let schema = Schema {
51
- tables_fields_names : tables_fields_names ( ) . to_owned ( ) ,
52
- tables_fields_types : tables_fields_types ( ) . to_owned ( ) ,
53
- } ;
54
-
55
- let std_signatures = functions:: fileql_std_signatures ( ) ;
56
- let std_functions = functions:: fileql_std_functions ( ) ;
57
-
58
- let aggregation_signatures = aggregation_function_signatures ( ) ;
59
- let aggregation_functions = aggregation_functions ( ) ;
60
-
61
- let mut env = Environment :: new ( schema) ;
62
- env. with_standard_functions ( & std_signatures, std_functions) ;
63
- env. with_aggregation_functions ( & aggregation_signatures, aggregation_functions) ;
64
46
47
+ let mut env = create_fileql_environment ( ) ;
65
48
execute_fileql_query ( query, & arguments, files, & mut env, & mut reporter) ;
66
49
}
67
50
Command :: Help => {
@@ -84,20 +67,7 @@ fn launch_fileql_repl(arguments: Arguments) {
84
67
return ;
85
68
}
86
69
87
- let schema = Schema {
88
- tables_fields_names : tables_fields_names ( ) . to_owned ( ) ,
89
- tables_fields_types : tables_fields_types ( ) . to_owned ( ) ,
90
- } ;
91
-
92
- let std_signatures = functions:: fileql_std_signatures ( ) ;
93
- let std_functions = functions:: fileql_std_functions ( ) ;
94
-
95
- let aggregation_signatures = aggregation_function_signatures ( ) ;
96
- let aggregation_functions = aggregation_functions ( ) ;
97
-
98
- let mut global_env = Environment :: new ( schema) ;
99
- global_env. with_standard_functions ( & std_signatures, std_functions) ;
100
- global_env. with_aggregation_functions ( & aggregation_signatures, aggregation_functions) ;
70
+ let mut global_env = create_fileql_environment ( ) ;
101
71
102
72
let mut input = String :: new ( ) ;
103
73
0 commit comments