aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tuple.ml
blob: 1ce73b0d5f7f04e5b66f19895df22c3cb229fbf7 (plain) (blame)
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
module AttributeMap = struct
  include Map.Make (String)

  let sexp_of_t sexp_of_v m =
    Sexplib.Sexp.List
      (List.map
         (fun (k, v) -> Sexplib.Sexp.List [ Sexplib.Sexp.Atom k; sexp_of_v v ])
         (bindings m))
end

type non_materialized = {
  hash : Conventions.Hash.t;
  relation : Conventions.Name.t;
  attributes : Attribute.referenced AttributeMap.t;
}
[@@deriving sexp_of]

type materialized = {
  relation : Conventions.Name.t;
  attributes : Attribute.materialized AttributeMap.t;
}
[@@deriving sexp_of]

type t = Materialized of materialized | NonMaterialized of non_materialized
[@@deriving sexp_of]

let make_materialized ~relation ~attributes =
  Materialized { relation; attributes }