aboutsummaryrefslogtreecommitdiffstats
path: root/lib/relation.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2024-11-25 00:20:05 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2024-11-25 00:20:05 -0300
commitf59749f0118807502618e25fba89c7a3fd083b54 (patch)
tree524bf89b394efe7fea4439a8f11b207364d1db25 /lib/relation.ml
parent3235bcba70e0b9a5e9a8ed0fc18f96ce5c6beb57 (diff)
downloadSakura-f59749f0118807502618e25fba89c7a3fd083b54.tar.gz
Sakura-f59749f0118807502618e25fba89c7a3fd083b54.zip
lwt socket server
Diffstat (limited to 'lib/relation.ml')
-rw-r--r--lib/relation.ml14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/relation.ml b/lib/relation.ml
index a4e14c4..1854875 100644
--- a/lib/relation.ml
+++ b/lib/relation.ml
@@ -1,9 +1,14 @@
open Sexplib0
open Sexplib0.Sexp_conv
-open Ppx_xml_conv
+
module Protocol = struct
- type tuples = string list list
- [@@deriving sexp, ]
+ type tuple = string list [@@deriving sexp]
+ type relation =
+ { attribute_name: string;
+ attribute_type: string;
+ tuples: tuple }
+ [@@deriving sexp]
+ type t = relation list [@@deriving sexp]
end
let write_and_retrieve() =
@@ -35,5 +40,6 @@ let write_and_retrieve() =
let+ (_, Command.Read last_name) = Command.commit_and_perform (List.tl stream) locations command_read2 in
(* List.iter (fun a -> print_endline a) (List.map Bytes.to_string first_name); *)
(* List.iter (fun a -> print_endline a) (List.map Bytes.to_string last_name); *)
- Ok (Sexp.to_string (Protocol.sexp_of_tuples [List.map Bytes.to_string first_name; List.map Bytes.to_string last_name]))
+ Ok (Sexp.to_string (Protocol.sexp_of_t [{attribute_name = "user/first-name"; attribute_type = "string"; tuples = List.map Bytes.to_string first_name};
+ {attribute_name = "user/last-name"; attribute_type = "string"; tuples = List.map Bytes.to_string last_name}]))
[@@warning "-8"] (* Suppress pattern match incomplete warnings *)