di/add-side-dependency
di/add-side-dependency
When root had eight dependencies a system with side depencency started up in the wrong order.
Now you can pass a map as the key argument to start many keys:
(t/deftest lookup-test
(with-open [root (di/start {:a `a :b `b})]
(let [{:keys [a b]} root]
(t/is (= :a a))
(t/is (= :b b)))))
With di/env-parsing
middleware, you can add env parsers.
(defn jetty
{::di/stop (memfn stop)}
[{port :env.long/PORT
handler `handler
:or {port 8080}}]
(jetty/run-jetty handler {:join? false
:port port}))
(di/start `jetty (di/env-parsing {:env.long parse-long}))
Now you can define a service with a multimethod:
(defmulti service
{::di/deps [::x]}
(fn [-deps kind] kind))
Now you can pass a vector as the key argument to start many keys:
(with-open [root (di/start [`handler `helper])]
(let [[handler helper] root]
...))
Base version.
Don't use it. I forgot the details.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close