Fork me on GitHub
#mount
<
2017-03-30
>
quan04:03:19

i'm using hugsql https://www.hugsql.org/ for db layer, basicaly it have separate sql files & load into clojure code via (hugsql/def-db-fns "path/to/file")

quan04:03:29

but when i change sql file & reload app via mount, sql funs in clojure code is not updated

quan04:03:48

is there something I can do with mount here?

tolitius04:03:46

@quan this happens because hugsql/def-db-fns is a macro that creates defs in your namespace: i.e. mount does not control those. what you could do is to use hugsql/map-of-db-fns that returns a map from a file instead: http://layerware.github.io/hugsql/hugsql.core.html#var-map-of-db-fns

tolitius04:03:55

you can create a state with a start function to load these SQL functions. this way when the state is restarted the SQL functions will be reloaded from a file

quan05:03:20

got it, thanks!