Liking cljdoc? Tell your friends :D

everest.pg.dynamic


*connection*clj

Holds the connection used by the pg.store, wrap-connection middleware and other everest.jdbc functionality in order to provide transactions spanning the whole handler chain.

Holds the connection used by the pg.store, `wrap-connection`
middleware and other everest.jdbc functionality in order to provide
transactions spanning the whole handler chain.
raw docstring

with-unbound-connectioncljmacro

(with-unbound-connection & forms)

Use this when you inherit the bindings of a thread that has the *connection* bound.

For example, suppose we have an event handler with PG Connection middleware which spawns a future and calls IEventStore functions inside. The *connection* binding will be copied into the thread running the Future. However, the connection itself will probably already be closed as the event handler execution is done.

(def handler (-> (fn [_] (future (dynamic/with-unbound-connection (store/read-stream-forward ...)))) (wrap-connection {:handler.middleware/db ...})))

Use this when you inherit the bindings of a thread that has the
`*connection*` bound.

For example, suppose we have an event handler with PG Connection middleware
which spawns a `future` and calls `IEventStore` functions inside. The
`*connection*` binding will be copied into the thread running the Future.
However, the connection itself will probably already be closed as the event
handler execution is done.

  (def handler
    (-> (fn [_]
          (future
            (dynamic/with-unbound-connection
              (store/read-stream-forward ...))))
        (wrap-connection {:handler.middleware/db ...})))
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close