Fork me on GitHub
#duct
<
2019-09-28
>
jahson08:09:31

:xyz.handler/somehandler
{:db #ig/ref :xyz.database/master
 :logger #ig/ref :duct/logger
 :cache #ig/ref :xyz.cache/history}

jahson08:09:12

You usually provide a component with dependencies and then use them.

jjttjj12:09:35

Ok I think I'm starting to get it. And so some handler would be defined as a fn in it's init-key implementation? And every function that uses logging would be defined this way instead of defn, and called like

((xyz.handler/some-handler system) x y)

jjttjj13:09:28

Like a handler example feels somewhat natural as a dependency. But what if I have a function which takes some data from an external API, saves it to a database, does some logging and returns the data. Should this function be defined with init-key and then called by looking up the function in the system map?