Skip to content

Instantly share code, notes, and snippets.

@magnars
Created August 12, 2015 09:58
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 magnars/093c6c437b1760ac22cf to your computer and use it in GitHub Desktop.
Save magnars/093c6c437b1760ac22cf to your computer and use it in GitHub Desktop.
;; find all historic :gateway/last-seen attribute for an entity
(d/q '[:find ?v
:in $ ?e
:where [?e :gateway/last-seen ?v]]
(d/history (d/db conn))
17592186045459)
#{[#inst "2015-08-12T09:52:53.716-00:00"]}
;; note that the attribute has noHistory set to true
(d/pull (d/db conn) '[*] :gateway/last-seen)
{:db/id 73
:db/ident :gateway/last-seen
:db/valueType {:db/id 25}
:db/cardinality {:db/id 35} ;; :db.cardinality/one
:db/noHistory true}
;; make a new request, resulting in an updated :last-seen attr
(d/q '[:find ?v
:in $ ?e
:where [?e :gateway/last-seen ?v]]
(d/history (d/db conn))
17592186045459)
#{[#inst "2015-08-12T09:54:08.737-00:00"] [#inst "2015-08-12T09:52:53.716-00:00"]}
;; now there are two entries in history
;; why? how?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment