Created
July 29, 2015 09:05
-
-
Save robert-stuttaford/4ad9c539976d23e9a1cf to your computer and use it in GitHub Desktop.
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
(let [dt #(-> (clj-time.core/date-time 2015 % %2) | |
clj-time.coerce/to-date) | |
now (d/db (d/connect (db/database-uri :main)))] | |
[(db/conn (db/database-uri :main)) | |
(vec | |
(for [db [now ;; 29th July 2015 | |
(-> now | |
(d/since (dt 2 1))) ;; 1st Feb 2015 | |
(-> now | |
(d/as-of (dt 2 1))) ;; 1st Feb 2015 | |
(-> now | |
(d/since (dt 2 1)) ;; 1st Feb 2015 | |
(d/as-of (dt 4 1)))]] ;; 1st April 2015 | |
[db | |
(->> db d/basis-t) | |
(->> db d/next-t) | |
(->> db d/basis-t d/t->tx) | |
(->> db d/basis-t d/t->tx (d/entity db) d/touch)]))]) | |
[#<Connection | |
{:db-id "db-50d3055e-99fc-4639-835c-16c5e88890f7" | |
:index-rev 625 | |
:basis-t 25630814 | |
:next-t 25630816 | |
:unsent-updates-queue 0 | |
:pending-txes 0}> | |
;; I thought i would see different :basis-tx, :next-t, :t->tx, and | |
;; entities for each of these cases. | |
[{:db datomic.db.Db@8f42a8dd | |
:basis-t 25630814 | |
:next-t 25630816 | |
:t->tx 13194165164126 | |
:touched-entity | |
{:db/txInstant #inst "2015-07-29T08:45:22.093-00:00" | |
:db/id 13194165164126}} | |
{:db datomic.db.Db@8e6794f5 | |
:basis-t 25630814 | |
:next-t 25630816 | |
:t->tx 13194165164126 | |
:touched-entity | |
{:db/txInstant #inst "2015-07-29T08:45:22.093-00:00" | |
:db/id 13194165164126}} | |
{:db datomic.db.Db@8e1d54f5 | |
:basis-t 25630814 | |
:next-t 25630816 | |
:t->tx 13194165164126 | |
:touched-entity {:db/id 13194165164126}} | |
{:db datomic.db.Db@8d2bde09 | |
:basis-t 25630814 | |
:next-t 25630816 | |
:t->tx 13194165164126 | |
:touched-entity {:db/id 13194165164126}}]] | |
tonsky
commented
Jul 29, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment