Skip to content

Commit

Permalink
Make Pgx_async only depend on Async_kernel and Asynx_unix
Browse files Browse the repository at this point in the history
This should slightly reduce our dependencies.
  • Loading branch information
brendanlong committed Apr 27, 2020
1 parent a09fdf9 commit 8ab0fd9
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
4 changes: 3 additions & 1 deletion pgx_async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ build: [
]

depends: [
"async" {>= "v0.13.0"}
"async_kernel" {>= "v0.13.0"}
"async_unix" {>= "v0.13.0"}
"pgx" {= version}
"pgx_value_core" {= version}

"alcotest-async" {with-test & >= "1.0.0"}
"base64" {with-test & >= "3.0.0"}
Expand Down
2 changes: 1 addition & 1 deletion pgx_async/bin/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(executables
(names pgx_async_example)
(libraries core async pgx_async))
(libraries pgx_async))

(alias
(name examples)
Expand Down
10 changes: 4 additions & 6 deletions pgx_async/bin/pgx_async_example.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(* A basic example of Pgx_async usage *)
open Core
open Async
open Core_kernel
open Async_kernel
open Async_unix

module Employee = struct
let create db =
Expand Down Expand Up @@ -137,7 +138,4 @@ let main () =
| _ -> assert false
;;

let () =
let summary = "Pgx_async example" in
Command.async ~summary (Command.Param.return main) |> Command.run
;;
let () = Thread_safe.block_on_async_exn main
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 pgx_value_core)
(libraries async_kernel async_unix pgx_value_core)
|} ^ preprocess ^ {|)
|}
5 changes: 3 additions & 2 deletions pgx_async/src/pgx_async.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
open Core
open Async
open Core_kernel
open Async_kernel
open Async_unix

(* Pgx allows to generate bindings from any module implementing their
THREAD signature which encompasses monadic concurrency + IO. The
Expand Down
2 changes: 1 addition & 1 deletion pgx_async/src/pgx_async.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(** Async based Postgres client based on Pgx. *)
open Async
open Async_kernel

include Pgx.S with type 'a monad = 'a Deferred.t

Expand Down
5 changes: 3 additions & 2 deletions pgx_async/src/pgx_async_test.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
open Core
open Async
open Core_kernel
open Async_kernel
open Async_unix
module Pga = Pgx_async

let default_database = "postgres"
Expand Down
2 changes: 1 addition & 1 deletion pgx_async/src/pgx_async_test.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(** Testing library for code that uses postgres *)

open Async
open Async_kernel

val set_to_default_db : unit -> unit

Expand Down

0 comments on commit 8ab0fd9

Please sign in to comment.