duct

Ahmed Hassan 2019-08-03T18:36:11.028100Z

When I change .sql files in Hugsql in duct and run (reset), changes are not projected in the project.

Ahmed Hassan 2019-08-03T18:36:55.029Z

Are sql files when changed reloaded to system, by using (reset)?

2019-08-03T18:41:00.030300Z

Not automatically. Duct has no inherent connection to Hugsql, so they’d have to be refreshed by whatever Hugsql component you’re using.

👍 1
2019-08-03T18:41:16.030600Z

Or in your dev script.

👍 1
Ahmed Hassan 2019-08-03T19:07:03.033900Z

(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.

Ahmed Hassan 2019-08-03T19:08:19.035400Z

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?

2019-08-03T19:09:40.036500Z

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 resetfunction.

Ahmed Hassan 2019-08-03T19:12:24.038Z

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.

2019-08-03T19:13:15.038800Z

You’d probably want to check the timestamps of the files and compare them to the timestamps you checked last time.

👍 1
Ahmed Hassan 2019-08-03T19:16:28.040200Z

Brilliant, so I'll also have to keep track of .clj namespaces in which "myapp/db/sql/my_sql_statements.sql" is referred?

2019-08-03T19:17:34.041200Z

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 🙂

👍 1
Ahmed Hassan 2019-08-03T19:19:11.042100Z

Thanks for directions, that would make workflow reloaded++ 🙂

Ahmed Hassan 2019-08-03T19:36:08.043700Z

I can watch .sql files with https://github.com/juxt/dirwatch. And dispatch some function on file change.

Ahmed Hassan 2019-08-03T19:37:39.045300Z

What would that function be like, which would notify duct/integrant that respective namespace to the changed .sql file need to be reloaded?

2019-08-03T19:39:07.046700Z

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.

👍 1
rboyd 2019-08-03T23:49:51.048Z

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

2019-08-03T23:51:03.048900Z

You return handlers that take three arguments instead of one, and set the :async? argument on the Jetty adapter to true.

rboyd 2019-08-08T14:09:57.061300Z

thanks!