This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-11
Channels
- # aws (15)
- # beginners (55)
- # boot (116)
- # bristol-clojurians (2)
- # cider (4)
- # cljs-dev (439)
- # cljsrn (14)
- # clojure (135)
- # clojure-argentina (3)
- # clojure-czech (4)
- # clojure-italy (60)
- # clojure-russia (1)
- # clojure-spec (48)
- # clojure-uk (42)
- # clojurescript (170)
- # cloverage (11)
- # core-async (19)
- # cursive (13)
- # datomic (48)
- # emacs (2)
- # graphql (3)
- # hoplon (8)
- # jobs (1)
- # jobs-discuss (5)
- # klipse (11)
- # luminus (5)
- # lumo (5)
- # mount (48)
- # off-topic (96)
- # om (17)
- # onyx (14)
- # parinfer (30)
- # protorepl (1)
- # re-frame (90)
- # reagent (2)
- # remote-jobs (1)
- # spacemacs (12)
- # specter (20)
- # uncomplicate (1)
- # untangled (65)
- # vim (2)
- # yada (8)
Does the dynamic mean you can change the sql while the app is running? I found that I need to restart the whole app when I make a type.
shidima_: You should be able to just reload the sql fns with something like this
(def db (atom nil))
(defmacro init-queries-connect!
[pool-spec resource-path]
`(do (reset! db (conman/connect! ~pool-spec))
(conman/bind-connection @db ~resource-path)))
(defn disconnect!
[]
(conman/disconnect! db)
(reset! db nil))
assuming you have access to the conmanpool-spec
is something like
{:jdbc-url (:database-url conf)}
or
{:jdbc-url "jdbc:
and resource-path
is
"sql/queries.sql"
and your sql file is located in
{project root}/resources/sql/
.
If you have any question about the above just ask away 🙂
Tnx, I will look into it. I'm quite prone to typos and having to restart the whole app is a bit annoying 🙂
also check out https://github.com/pallet/alembic for adding deps to a running repl
@U0S3YK6HK these are just the low level puzzle pieces you mentioned. tolitius/mount
and stuartsierra/component
and his reloaded workflow is meant to unify and codify these into a consistent and more flexible convention or framework.
Using dynamic vars is one of the patterns which was alleviated by using mount or component, that's why it was surprising to see them combined.
But @U050CBXUZ on #luminus gave an explanation why it might make sense still (which I'm still suspicious of but can't argue with because I don't know conman
)