di/add-side-dependency
bug (#32)Improved di/update-key
. It will throw an exception on a non-existent key (#23)
Improved naming of generated keys in update-key
ex-info
for easier debugging.update-key
.di/ns-publics
registry middlewareUse {::di/kind :component}
to mark a component.
A zero arity service are not a component of zero arity function now.
;; v2
(defn schema-component
[{ddl `clickhouse/ddl
ttl "TTL_DAY"
:or {ttl "30"}}]
(ddl ...))
;; v3
(defn schema-component
{::di/kind :component}
[{ddl `clickhouse/ddl
ttl "TTL_DAY"
:or {ttl "30"}}]
(ddl ...))
;; v2
(defn my-service []
(fn []
...))
;; v3
(defn my-service []
...)
di/update-key
Explicitly use (di/ref)
or other factory to refer to a component.
;; v2
(di/update-key `reitit/route-data conj `raw-method/route-data)
;; v3
(di/update-key `reitit/route-data conj (di/ref `raw-method/route-data))
;; v2
(di/update-key `raw-method/methods #(assoc %1 param-name %2) method)))
;; v3
(di/update-key `raw-method/methods assoc param-name (di/ref method))))
di/derive
instead of di/fmap
The di/fmap
factory constructor was removed.
Use di/derive
instead.
di/instument
removingThe di/instument
registry middleware was removed. Maybe there will be a rewrited version.
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