biff 2024-09-04

does biff have any way for me to conveniently (in a REPL) query the underlying xtdb database? I've been resorting to doing def s in some middleware to get access to the node and the db:

(defn some-middleware [handler]
  (fn [...]
    (def biffnode (:biff.xtdb/node ctx))
    (def biffdb (:biff/db ctx))
    ...
That does give me access to the node and the db in the REPL once I'm in the middleware ns... but one problem I find with this approach is that my view of the db can become outdated once I start doing deletes in the REPL (to clean up some data, for example). So if I remove one user, if I were to query the db again, I would still see the user. I would have to trigger a HTTP request (to trigger the middleware, and thereby refresh the defs) before I actually see the change in the db.

1. wow 2. shucks, I wasted so much time 3. thank you!!!

any time 😉

1