aboutsummaryrefslogtreecommitdiffstats
path: root/lib/concepts/Relation.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-08-02 23:37:51 -0300
committerEstevan Castilho <tevo@riajuu.net>2026-08-23 03:06:53 +0000
commit8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3 (patch)
tree6a673397f921070d8a86d026380548d5e251a29f /lib/concepts/Relation.ml
parentb762cb41da4d822416c3ab66940622882745fc0a (diff)
downloadRNT-8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3.tar.gz
RNT-8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3.zip
format
Diffstat (limited to '')
-rw-r--r--lib/concepts/Relation.ml18
-rw-r--r--lib/concepts/Relation.mli2
2 files changed, 5 insertions, 15 deletions
diff --git a/lib/concepts/Relation.ml b/lib/concepts/Relation.ml
index a4fb341..1194804 100644
--- a/lib/concepts/Relation.ml
+++ b/lib/concepts/Relation.ml
@@ -1,10 +1,6 @@
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"
@@ -25,31 +21,27 @@ 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 5319a3d..d370578 100644
--- a/lib/concepts/Relation.mli
+++ b/lib/concepts/Relation.mli
@@ -5,11 +5,9 @@ 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