|
|
@ -14,16 +14,28 @@
|
|
|
|
#(re-matches
|
|
|
|
#(re-matches
|
|
|
|
#"[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+" %))
|
|
|
|
#"[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+" %))
|
|
|
|
|
|
|
|
|
|
|
|
(def conn
|
|
|
|
(defn create-conn!
|
|
|
|
|
|
|
|
([]
|
|
|
|
(let [env #(or (System/getenv %1) %2)
|
|
|
|
(let [env #(or (System/getenv %1) %2)
|
|
|
|
port (env "NEO4J_PORT" "7687")
|
|
|
|
port (env "NEO4J_PORT" "7687")
|
|
|
|
host (env "NEO4J_HOST" "localhost")
|
|
|
|
host (env "NEO4J_HOST" "localhost")
|
|
|
|
user (env "NEO4J_USER" "neo4j")
|
|
|
|
user (env "NEO4J_USER" "neo4j")
|
|
|
|
pass (env "NEO4J_PASS" "b")]
|
|
|
|
pass (env "NEO4J_PASS" "b")]
|
|
|
|
(delay (db/connect
|
|
|
|
(create-conn! port host user pass)))
|
|
|
|
|
|
|
|
([port host user pass]
|
|
|
|
|
|
|
|
(db/connect
|
|
|
|
(str "bolt://" host ":" port)
|
|
|
|
(str "bolt://" host ":" port)
|
|
|
|
user
|
|
|
|
user
|
|
|
|
pass))))
|
|
|
|
pass)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(def conn
|
|
|
|
|
|
|
|
(atom nil))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defn reset-conn!
|
|
|
|
|
|
|
|
([]
|
|
|
|
|
|
|
|
(reset! conn (create-conn!)))
|
|
|
|
|
|
|
|
([port host user pass]
|
|
|
|
|
|
|
|
(reset! conn (create-conn! port host user pass))))
|
|
|
|
|
|
|
|
|
|
|
|
(defmacro defquery [& args] `(db/defquery ~@args))
|
|
|
|
(defmacro defquery [& args] `(db/defquery ~@args))
|
|
|
|
|
|
|
|
|
|
|
@ -40,12 +52,15 @@
|
|
|
|
(cljs/join \newline)))
|
|
|
|
(cljs/join \newline)))
|
|
|
|
|
|
|
|
|
|
|
|
(defn exec-query! [qry params]
|
|
|
|
(defn exec-query! [qry params]
|
|
|
|
(with-open [session (db/get-session @conn)]
|
|
|
|
(let [live-conn (if (nil? @conn)
|
|
|
|
|
|
|
|
(reset-conn!)
|
|
|
|
|
|
|
|
@conn)]
|
|
|
|
|
|
|
|
(with-open [session (db/get-session live-conn)]
|
|
|
|
(devmode/send-to-bar
|
|
|
|
(devmode/send-to-bar
|
|
|
|
(str (butiful-query qry)
|
|
|
|
(str (butiful-query qry)
|
|
|
|
"<br>---Params---<br>"
|
|
|
|
"<br>---Params---<br>"
|
|
|
|
params))
|
|
|
|
params))
|
|
|
|
(qry session params)))
|
|
|
|
(qry session params))))
|
|
|
|
|
|
|
|
|
|
|
|
(spec/def ::tuple-query-list
|
|
|
|
(spec/def ::tuple-query-list
|
|
|
|
(spec/coll-of
|
|
|
|
(spec/coll-of
|
|
|
|