Skip to content

Instantly share code, notes, and snippets.

@refset
Created August 23, 2021 00:22
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 refset/385d6dcfb66772aa1ec46fc20a49c633 to your computer and use it in GitHub Desktop.
Save refset/385d6dcfb66772aa1ec46fc20a49c633 to your computer and use it in GitHub Desktop.
get-valid-time.clj
(defn get-valid-time [db e]
(with-open [h (crux/open-entity-history db e :desc)]
(:crux.db/valid-time (first (iterator-seq h)))))
(crux/q (crux/db (crux-node))
'{:find [e vt]
:limit 1
:where [[e :crux.db/id]
[(my-ns/get-valid-time $ e) vt]]})
;;=> [[:bar #inst "2021-08-05T15:18:45.952-00:00"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment