aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/importerSyntax.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syntax/importerSyntax.ml')
-rw-r--r--lib/syntax/importerSyntax.ml27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/syntax/importerSyntax.ml b/lib/syntax/importerSyntax.ml
index 7788613..d91db09 100644
--- a/lib/syntax/importerSyntax.ml
+++ b/lib/syntax/importerSyntax.ml
@@ -14,13 +14,18 @@ let toml_of_table Table.{ file; tab; name } =
Otoml.table values
+let repr_expression_list ~repr l =
+ Otoml.array
+ (List.map l ~f:(fun v ->
+ Otoml.string (ImportExpression.Repr.repr ~top:true repr v)))
+
module Extern = struct
type t = {
intern_key : Path.t E.t;
target : Table.t;
extern_key : Path.column E.t;
allow_missing : bool;
- match_rule : string option;
+ filters : ImportDataTypes.Path.column ImportExpression.T.t list;
}
[@@deriving show, eq]
(** Describe a relation beteween two tables *)
@@ -38,6 +43,10 @@ module Extern = struct
extern.extern_key );
("file", Otoml.string extern.target.file);
("allow_missing", Otoml.boolean extern.allow_missing);
+ ( "filters",
+ repr_expression_list
+ ~repr:(fun s -> ":" ^ Path.column_to_string s)
+ extern.filters );
]
in
@@ -66,19 +75,13 @@ type t = {
}
let repr t =
- let repr_expression_list l =
- Otoml.array
- (List.map l ~f:(fun v ->
- Otoml.string (ImportExpression.Repr.repr ~top:true Path.show v)))
- in
-
let sheet =
Otoml.table
[
- ("columns", repr_expression_list t.columns);
- ("filters", repr_expression_list t.filters);
- ("sort", repr_expression_list t.sort);
- ("uniq", repr_expression_list t.uniq);
+ ("columns", repr_expression_list ~repr:Path.show t.columns);
+ ("filters", repr_expression_list ~repr:Path.show t.filters);
+ ("sort", repr_expression_list ~repr:Path.show t.sort);
+ ("uniq", repr_expression_list ~repr:Path.show t.uniq);
]
in
@@ -128,7 +131,7 @@ let dummy_conf =
{
source = { file = ""; tab = 0; name = "" };
version = latest_version;
- locale = Some "C";
+ locale = None;
externals = [];
columns = [];
filters = [];