From fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sat, 22 Mar 2025 14:00:01 -0300 Subject: add relation type and format --- lib/relation.ml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'lib/relation.ml') diff --git a/lib/relation.ml b/lib/relation.ml index 798a082..275bd10 100644 --- a/lib/relation.ml +++ b/lib/relation.ml @@ -1,12 +1,22 @@ let write_and_retrieve () = let open Disk in - let schema = Executor.StringMap.empty |> Executor.StringMap.add "user" [("first_name", Executor.Text); ("last_name", Executor.Text)] in + let schema = + Executor.StringMap.empty + |> Executor.StringMap.add "user" + [ + ("first_name", Executor.Text); + ("last_name", Executor.Text); + ("address", Executor.Relation "address"); + ] + |> Executor.StringMap.add "address" + [ ("street", Executor.Text); ("number", Executor.Integer32) ] + in let commit : Executor.commit = { state = Executor._EMPTY_SHA_HASH_; files = Executor.StringMap.empty; references = Executor.StringMap.empty; - schema + schema; } in let locations : Executor.locations = Executor.StringMap.empty in @@ -112,11 +122,16 @@ let write_and_retrieve () = let+ _, (Command.Read content as response) = Command.commit_and_perform commit locations command_read in - Executor.StringMap.iter (fun k v -> print_endline ("→ " ^ k ^ ": "); - Executor.IntMap.iter (fun k v -> - print_endline (" ↳ " ^ (Int64.to_string k)); - List.iter (fun v -> print_endline (" → " ^ v)) v) v; - print_newline()) references; + Executor.StringMap.iter + (fun k v -> + print_endline ("→ " ^ k ^ ": "); + Executor.IntMap.iter + (fun k v -> + print_endline (" ↳ " ^ Int64.to_string k); + List.iter (fun v -> print_endline (" → " ^ v)) v) + v; + print_newline ()) + references; print_endline (Command.show_return response); Ok (commit, locations) [@@warning "-8-27-26"] -- cgit v1.2.3