di/ns-publics
registry middleware
Use {::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 []
...)
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))))
The di/fmap
factory constructor was removed.
Use di/derive
instead.
The di/instument
registry middleware was removed. Maybe there will be a rewrited version.
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.