aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Relation.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-08-02 23:38:05 -0300
committerEstevan Castilho <tevo@riajuu.net>2026-08-23 03:06:53 +0000
commitb790c77c5e42a220a8419c69dbea3e392ee60fbe (patch)
tree546d27d92f470d7f90ea7a76b6720039f3ed4291 /lib/concepts/Relation.ml
parent8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3 (diff)
downloadRNT-b790c77c5e42a220a8419c69dbea3e392ee60fbe.tar.gz
RNT-b790c77c5e42a220a8419c69dbea3e392ee60fbe.zip
Revert "format"
This reverts commit fee14f4b29840357f87f02d51953f41ce90f7d9e.
Diffstat (limited to '')
-rw-r--r--lib/concepts/Relation.ml18
-rw-r--r--lib/concepts/Relation.mli2
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/concepts/Relation.ml b/lib/concepts/Relation.ml
index 1194804..a4fb341 100644
--- a/lib/concepts/Relation.ml
+++ b/lib/concepts/Relation.ml
@@ -1,6 +1,10 @@
type address = Hash.hash
type schema = string BatMap.String.t
-type t = {name: string; tuples: address; schema: schema}
+
+type t =
+ { name: string;
+ tuples: address;
+ schema: schema }
module Field = struct
let name = "name"
@@ -21,27 +25,31 @@ module Error = struct
end
let make ~name ~tuples ~schema = {name; tuples; schema}
+
let name relation = relation.name
let tuples relation = relation.tuples
let schema relation = relation.schema
+
let schema_empty = BatMap.String.empty
let schema_of_list fields =
- List.fold_left (fun acc (name, domain) -> BatMap.String.add name domain acc) schema_empty fields
+ List.fold_left (fun acc (name, domain) -> BatMap.String.add name domain acc) schema_empty
+ fields
let schema_to_list schema = BatMap.String.bindings schema
let schema_to_bencode schema =
Codec.Bencode.Dict
- (schema_to_list schema |> List.map (fun (name, domain) -> name, Codec.Bencode.String domain))
+ (schema_to_list schema
+ |> List.map (fun (name, domain) -> name, Codec.Bencode.String domain) )
let schema_of_bencode value =
let open Utilities.Result in
let* fields = Codec.Bencode.as_dict value in
fields
|> List.map (fun (name, domain) ->
- let* domain = Codec.Bencode.as_string domain in
- Ok (name, domain) )
+ let* domain = Codec.Bencode.as_string domain in
+ Ok (name, domain) )
|> sequence
|> Result.map schema_of_list
diff --git a/lib/concepts/Relation.mli b/lib/concepts/Relation.mli
index d370578..5319a3d 100644
--- a/lib/concepts/Relation.mli
+++ b/lib/concepts/Relation.mli
@@ -5,9 +5,11 @@ type schema
include Object.S with type t := t
val make : name:string -> tuples:address -> schema:schema -> t
+
val name : t -> string
val tuples : t -> address
val schema : t -> schema
+
val schema_empty : schema
val schema_of_list : (string * string) list -> schema
val schema_to_list : schema -> (string * string) list