Skip to content

Commit

Permalink
add pgwire-playground to fiddle server
Browse files Browse the repository at this point in the history
  • Loading branch information
jarohen committed Mar 19, 2024
1 parent ad37e21 commit dc2a796
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
5 changes: 2 additions & 3 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion src/main.clj
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/pgwire.clj
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit dc2a796

Please sign in to comment.