-
-
Save refset/8439ceebf3c1f08c614b0c818266a140 to your computer and use it in GitHub Desktop.
entity-history-in-query.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn get-vt-created [db eid] | |
(with-open [h (xt/open-entity-history db eid :asc)] | |
(-> (iterator-seq h) | |
first | |
::xt/valid-time))) | |
(defn get-vt-last-updated [db eid] | |
(with-open [h (xt/open-entity-history db eid :desc)] | |
(-> (iterator-seq h) | |
first | |
::xt/valid-time))) | |
(xt/q (xt/db my-node) | |
'{:find [e vt-created vt-last-updated] | |
:limit 1 | |
:where [[e :xt/id] | |
[(dev/get-vt-created $ e) vt-created] | |
[(dev/get-vt-last-updated $ e) vt-last-updated]]}) | |
;;=> [[-219 #inst "2021-10-15T12:01:06.289-00:00" #inst "2021-10-15T12:15:11.020-00:00"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment