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")
but when i change sql file & reload app via mount, sql funs in clojure code is not updated
is there something I can do with mount here?
@quan this happens because hugsql/def-db-fns
is a macro that creates def
s 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
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
got it, thanks!
sure