datahike

silian 2025-06-16T03:05:45.076349Z

This is a question about datahike connections. In a Clojure web app with datahike, Claude elected to use the following pattern for most business logic -- I'm wondering if there is good rationale for this:

(defn cool-fn [x]
  (let
   [conn (get-connection)
    ...]
    (d/transact conn {:tx-data [{:any "Data"}])
    (d/release conn)
    ...))

silian 2025-06-16T03:08:28.850409Z

Indirection is usually used for good reason in Clojure — just not sure if Claude knows that in this case : )

whilo 2025-06-16T16:08:32.975219Z

You don't have to release the connection really unless you delete the database. I would pass the connection to functions explicitly, but if you just have one global connection then maybe it is fine.

1