When I change .sql
files in Hugsql in duct and run (reset), changes are not projected in the project.
Are sql files when changed reloaded to system, by using (reset)?
Not automatically. Duct has no inherent connection to Hugsql, so they’d have to be refreshed by whatever Hugsql component you’re using.
Or in your dev script.
(hugsql/def-db-fns "myapp/db/sql/my_sql_statements.sql")
this is function included in boundary
namespace in which duct.database.sql.Boundary
is implemented.
should I wrap hugsql/def-db-fns
in ig/init-key
multi-method and pass "myapp/db/sql/my_sql_statements.sql"
to it inside config.edn
?
If you only care about refreshing the DB functions during development, you should probably write a development function for that, and hook it into a custom reset
function.
Like a function to reload namespaces in which (hugsql/def-db-fns "myapp/db/sql/my_sql_statements.sql")
sort of statements are defined? But how would such a function know which .sql
files have changed.
You’d probably want to check the timestamps of the files and compare them to the timestamps you checked last time.
Brilliant, so I'll also have to keep track of .clj
namespaces in which "myapp/db/sql/my_sql_statements.sql"
is referred?
Yes. You might want to add metadata to the namespaces. There might even be a project out there that does this already. You’ll need to research and experiment 🙂
Thanks for directions, that would make workflow reloaded++ 🙂
I can watch .sql
files with https://github.com/juxt/dirwatch. And dispatch some function on file change.
What would that function be like, which would notify duct/integrant that respective namespace to the changed .sql
file need to be reloaded?
Ideally you wouldn’t complect the ideas of file watching and reloading. You’d write a function that would reload the SQL files if any were changed since last it was run.
is there syntax for duct.module/ataraxy handlers to do async? I see https://github.com/weavejester/ataraxy/blob/ac4e441afaf8fa89dcbe93f319659832f7bd9c48/src/ataraxy/handler.clj#L21 but I'm confused how I would declare my async handler in my config
You return handlers that take three arguments instead of one, and set the :async?
argument on the Jetty adapter to true
.
thanks!