sieppari icon indicating copy to clipboard operation
sieppari copied to clipboard

Consider including `with-bindings` support

Open robert-stuttaford opened this issue 3 years ago • 2 comments

Adding support for appears to be straight-forward:

https://github.com/metosin/sieppari/commit/bd54b969368df7945e175457ad8646cb93c8daa4

All one has to do is set :bindings on the context within any :enter interceptor:

(def ^:dynamic *transacting-user-id* nil)

(defn transacting-user-interceptor []
  {:name  ::transacting-user
   :enter (fn [ctx]
            (let [user-id (get-in ctx [:request :user :db/id])]
              (update ctx :bindings merge {#'*transacting-user-id* user-id})))})

I don't know enough about the async mode to know whether this is sufficient for that use-case.

robert-stuttaford avatar Jan 11 '23 05:01 robert-stuttaford

This is interesting, thank you. I will investigate this.

jarppe avatar May 11 '23 05:05 jarppe

Gave implementing this a go in #55. Didn't want to be that guy and post "what's the status on this?" 😆.

Thanks @robert-stuttaford, for the starting point 🙂!

bnert avatar Mar 31 '24 13:03 bnert