Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@
(and
:with-test
(>= "1.0.0")))
(async_log
(>= "v0.17.0"))
(async_kernel
(>= "v0.13.0"))
(>= "v0.17.0"))
(async_unix
(>= "v0.13.0"))
(>= "v0.17.0"))
async_ssl
(base64
(and
Expand All @@ -96,6 +98,17 @@
(pgx_value_core
(= :version))))

(package
(name pgx_eio)
(synopsis "Pgx using Eio for IO")
(description "Pgx using Eio for IO")
(depends
eio
(ocaml
(>= 5.00))
(pgx
(= :version))))

(package
(name pgx_lwt)
(synopsis "Pgx using Lwt for IO")
Expand Down
7 changes: 4 additions & 3 deletions pgx/test/test_pgx_value.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ open Sexplib0
open Sexplib0.Sexp_conv
open Pgx.Value

let uuid_v4 = Uuidm.v4_gen (Random.State.make_self_init ())

let pp_value ppf x = Sexp.pp_hum ppf (sexp_of_t x)
let equal_value (x : t) (y : t) = x = y
let pp_hstore ppf x = Sexp.pp_hum ppf (sexp_of_hstore x)
let equal_hstore x y = Sexp.equal (sexp_of_hstore x) (sexp_of_hstore y)
let printer sexp value = sexp value |> Sexp.to_string_hum
let sort_hstore = List.sort (fun (k, _) (k', _) -> String.compare k k')
let to_hstore_sorted v = to_hstore v |> Option.map sort_hstore
let to_hstore_sorted_exn v = to_hstore_exn v |> sort_hstore
Expand Down Expand Up @@ -169,7 +170,7 @@ let () =
; null
; of_point (-5., 100.)
; unit
; of_uuid (Uuidm.create `V4)
; of_uuid (uuid_v4 ())
; of_string all_chars
]
]
Expand Down Expand Up @@ -197,7 +198,7 @@ let () =
of_uuid
to_uuid
to_uuid_exn
[ Uuidm.create `V4 ]
[ uuid_v4 () ]
[ ""; "asd" ]
]
;;
5 changes: 3 additions & 2 deletions pgx_async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ bug-reports: "https://github.com/arenadotio/pgx/issues"
depends: [
"dune" {>= "3.2"}
"alcotest-async" {with-test & >= "1.0.0"}
"async_kernel" {>= "v0.13.0"}
"async_unix" {>= "v0.13.0"}
"async_log" {>= "v0.17.0"}
"async_kernel" {>= "v0.17.0"}
"async_unix" {>= "v0.17.0"}
"async_ssl"
"base64" {with-test & >= "3.0.0"}
"conduit-async" {>= "1.5.0"}
Expand Down
2 changes: 1 addition & 1 deletion pgx_async/bin/pgx_async_example.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* A basic example of Pgx_async usage *)
open Core_kernel
open Core
open Async_kernel
open Async_unix

Expand Down
2 changes: 1 addition & 1 deletion pgx_async/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ let () = Jbuild_plugin.V1.send @@ {|
(library
(public_name pgx_async)
(wrapped false)
(libraries async_kernel async_unix conduit-async pgx_value_core)
(libraries async_kernel async_log async_unix conduit-async pgx_value_core)
|} ^ preprocess ^ {|)
|}
10 changes: 5 additions & 5 deletions pgx_async/src/pgx_async.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Core_kernel
open Core
open Async_kernel
open Async_unix

Expand Down Expand Up @@ -34,7 +34,7 @@ module Thread = struct
let output_string w s = return (Writer.write w s)

let output_binary_int w n =
let chr = Caml.Char.chr in
let chr = Stdlib.Char.chr in
Writer.write_char w (chr (n lsr 24));
Writer.write_char w (chr ((n lsr 16) land 255));
Writer.write_char w (chr ((n lsr 8) land 255));
Expand All @@ -56,7 +56,7 @@ module Thread = struct
>>| function
| `Eof _ -> raise Pgx_eof
| `Ok ->
let code = Caml.Char.code in
let code = Stdlib.Char.code in
(code (Bytes.get b 0) lsl 24)
lor (code (Bytes.get b 1) lsl 16)
lor (code (Bytes.get b 2) lsl 8)
Expand Down Expand Up @@ -98,8 +98,8 @@ module Thread = struct
let getlogin () = Unix.getuid () |> Unix.Passwd.getbyuid_exn >>| fun { name; _ } -> name

let debug msg =
Log.Global.debug ~tags:[ "lib", "pgx_async" ] "%s" msg;
Log.Global.flushed ()
Async_log.Global.debug ~tags:[ "lib", "pgx_async" ] "%s" msg;
Async_log.Global.flushed ()
;;

let protect f ~finally = Monitor.protect f ~finally
Expand Down
2 changes: 1 addition & 1 deletion pgx_async/src/pgx_async_test.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Core_kernel
open Core
open Async_kernel
open Async_unix
module Pga = Pgx_async
Expand Down
32 changes: 32 additions & 0 deletions pgx_eio.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Pgx using Eio for IO"
description: "Pgx using Eio for IO"
maintainer: ["Arena Developers <[email protected]>"]
authors: ["Arena Developers <[email protected]>"]
license: "LGPL-2.0-only with OCaml-LGPL-linking-exception"
homepage: "https://github.com/arenadotio/pgx"
doc: "https://arenadotio.github.io/pgx"
bug-reports: "https://github.com/arenadotio/pgx/issues"
depends: [
"dune" {>= "3.2"}
"eio"
"ocaml" {>= "5.00"}
"pgx" {= version}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/arenadotio/pgx.git"
15 changes: 15 additions & 0 deletions pgx_eio/src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(* -*- tuareg -*- *)

let preprocess =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "(preprocess (pps bisect_ppx))"
| _ -> ""
| exception Not_found -> ""

let () = Jbuild_plugin.V1.send @@ {|

(library
(public_name pgx_eio)
(libraries eio eio.unix pgx unix)
|} ^ preprocess ^ {|)
|}
Loading