aboutsummaryrefslogtreecommitdiffstats
path: root/lib/relation.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2025-03-22 14:00:01 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2025-03-22 14:00:01 -0300
commitfb0ade9daf1e9d1cd0a29dd1abe87468ab03a174 (patch)
tree255b7a8bece7e791ebf8ba8ad6d424f744b33030 /lib/relation.ml
parentd533b170f6b614000a84f8b3a6174f6fc539eb90 (diff)
downloadSakura-fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174.tar.gz
Sakura-fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174.zip
add relation type and format
Diffstat (limited to 'lib/relation.ml')
-rw-r--r--lib/relation.ml29
1 files changed, 22 insertions, 7 deletions
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"]