aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
parent3235bcba70e0b9a5e9a8ed0fc18f96ce5c6beb57 (diff)
downloadSakura-f59749f0118807502618e25fba89c7a3fd083b54.tar.gz
Sakura-f59749f0118807502618e25fba89c7a3fd083b54.zip
lwt socket server
Diffstat (limited to 'lib')
-rw-r--r--lib/dune2
-rw-r--r--lib/relation.ml14
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/dune b/lib/dune
index 8ad4a95..5b495a2 100644
--- a/lib/dune
+++ b/lib/dune
@@ -1,6 +1,6 @@
(library
(name relational_engine)
- (libraries ctypes ctypes-foreign data-encoding)
+ (libraries ctypes ctypes-foreign data-encoding lwt lwt.unix lwt_log)
(preprocess (pps ppx_deriving.show ppx_sexp_conv))
;; (c_library_flags -lssl -lcrypto -L %{env:LIBRESSL_LIB_PATH=})
;; (foreign_stubs
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 *)