Skip to content

Instantly share code, notes, and snippets.

@benkamphaus
Last active March 12, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benkamphaus/7eaa6484a254a14f8f1f to your computer and use it in GitHub Desktop.
Save benkamphaus/7eaa6484a254a14f8f1f to your computer and use it in GitHub Desktop.
Look up a transaction by its uuid (will match uuid in logs)
(require '[datomic.api :as d])
(defn tx-maps [log start]
(into [] (map #(into {} %) (d/tx-range log start nil))))
(defn txid-match? [uuid]
(fn [tx-map]
(= uuid (:id tx-map))))
(defn lookup-tx [log uuid-val]
(let [txes (tx-maps log nil)
(filter (txid-match? uuid-val) txes)))
(comment
(d/connect "YOUR-URI-HERE")
(lookup-tx (d/log conn) #uuid "54a6c755-4624-4aa3-807f-16e99d8dd199")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment