Skip to content

Obtain end-valid time of a document #1443

Answered by refset
lgrapenthin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, you can use the entity-history (or open-entity-history) API for this. e.g.

(-> node
    (crux/submit-tx [[:crux.tx/put {:crux.db/id :foo} #inst "2021-01-01" #inst "2021-01-02"]])
    (crux/await-tx))

(crux/entity-history (crux/db node) :foo :desc)
;; =>
[{:crux.tx/tx-time #inst "2021-02-28T10:56:16.632-00:00",
  :crux.tx/tx-id 0, :crux.db/valid-time #inst "2021-01-02T00:00:00.000-00:00",
  :crux.db/content-hash #crux/id 0000000000000000000000000000000000000000}
 {:crux.tx/tx-time #inst "2021-02-28T10:56:16.632-00:00",
  :crux.tx/tx-id 0, :crux.db/valid-time #inst "2021-01-01T00:00:00.000-00:00",
  :crux.db/content-hash #crux/id 91ef073d59b7ba3f52dbb6f6f58181dcfc2f44a4}]

The end-valid…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lgrapenthin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1441 on February 28, 2021 10:56.