diff --git a/deps.edn b/deps.edn index a0108ad..6d7af99 100644 --- a/deps.edn +++ b/deps.edn @@ -6,6 +6,7 @@ ;; XTDB dependencies com.xtdb/xtdb-api {:mvn/version "2.0.0-SNAPSHOT"} com.xtdb/xtdb-core {:mvn/version "2.0.0-SNAPSHOT"} + com.xtdb.labs/xtdb-pgwire-server {:mvn/version "2.0.0-SNAPSHOT"} ;; Webserver dependencies metosin/reitit {:mvn/version "0.6.0"} diff --git a/dev/user.clj b/dev/user.clj index 4d6cd3a..f4b77d8 100644 --- a/dev/user.clj +++ b/dev/user.clj @@ -1,5 +1,5 @@ (ns user - (:require [server] + (:require [main] [clojure.java.browse :as browse] [clojure.java.io :as io] [clojure.tools.namespace.repl :as repl] @@ -14,8 +14,7 @@ [] (watch-deps/start! {:aliases [:dev :test]})) - -(integrant.repl/set-prep! #(ig/prep {:server/server {:join false :port 8000}})) +(igr/set-prep! #(ig/prep main/system)) (def go! go) diff --git a/src/main.clj b/src/main.clj index f887dee..aebf7b5 100644 --- a/src/main.clj +++ b/src/main.clj @@ -1,11 +1,14 @@ (ns main (:require [server] + [pgwire :as pgw] [integrant.core :as ig]) (:gen-class)) (def system {:server/server {:join false - :port 8000}}) + :port 8000} + + ::pgw/playground {}}) (defn -main [& _args] (ig/init system) diff --git a/src/pgwire.clj b/src/pgwire.clj new file mode 100644 index 0000000..3dc3da9 --- /dev/null +++ b/src/pgwire.clj @@ -0,0 +1,10 @@ +(ns pgwire + (:require [integrant.core :as ig] + [xtdb.pgwire.playground :as play]) + (:import [java.lang AutoCloseable])) + +(defmethod ig/init-key ::playground [_ opts] + (play/open-playground opts)) + +(defmethod ig/halt-key! ::playground [_ ^AutoCloseable playground] + (.close playground))