diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2025-04-10 20:27:59 +0200 | 
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2025-04-12 09:47:47 +0200 | 
| commit | c284321b1073e06481c63e2c061a1600fa68254d (patch) | |
| tree | 87155166131f8bdfce92dbb5eb68e66b223fa1fd /lib/syntax | |
| parent | 9e2dbe43abe97c4e60b158e5fa52172468a2afb8 (diff) | |
Added filters expressions in the externals
Diffstat (limited to 'lib/syntax')
| -rw-r--r-- | lib/syntax/importerSyntax.ml | 25 | ||||
| -rw-r--r-- | lib/syntax/importerSyntax.mli | 2 | 
2 files changed, 15 insertions, 12 deletions
| diff --git a/lib/syntax/importerSyntax.ml b/lib/syntax/importerSyntax.ml index cfbba81..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 diff --git a/lib/syntax/importerSyntax.mli b/lib/syntax/importerSyntax.mli index 49b7364..47dabe6 100644 --- a/lib/syntax/importerSyntax.mli +++ b/lib/syntax/importerSyntax.mli @@ -4,7 +4,7 @@ module Extern : sig      target : ImportDataTypes.Table.t;      extern_key : ImportDataTypes.Path.column ImportExpression.T.t;      allow_missing : bool; -    match_rule : string option; +    filters : ImportDataTypes.Path.column ImportExpression.T.t list;    }    [@@deriving show, eq]  end | 
