mount

quan 2017-03-30T04:08:19.047071Z

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

quan 2017-03-30T04:08:29.047877Z

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

quan 2017-03-30T04:08:48.049180Z

is there something I can do with mount here?

tolitius 2017-03-30T04:46:46.218249Z

@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

tolitius 2017-03-30T04:47:55.223140Z

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

quan 2017-03-30T05:06:20.307492Z

got it, thanks!

tolitius 2017-03-30T05:14:03.344378Z

sure