Fork me on GitHub
#cursive
<
2017-07-11
>
shidima_06:07:45

@onetom Cool, nice find 🙂

shidima_06:07:02

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.

royalaid10:07:03

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 conman

royalaid10:07:49

pool-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 🙂

shidima_10:07:38

Tnx, I will look into it. I'm quite prone to typos and having to restart the whole app is a bit annoying 🙂

royalaid10:07:38

yeah I hate that too

royalaid10:07:09

also check out https://github.com/pallet/alembic for adding deps to a running repl

royalaid10:07:28

for reseting state in a namespace

onetom22:07:53

@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)

erichmond23:07:18

Is there a way to "add source root" when working with a cljs project so we can get keyword highlighting?

erichmond23:07:02

nvm, the issue is that we are using boot, not lein ... sorry