-
-
Save souenzzo/eb3753302d5af047346ac1c510500e69 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
(require '[datomic.client.api :as d]) | |
(let [conn (-> {:server-type :dev-local | |
:system "hello"} | |
d/client | |
(doto (d/delete-database {:db-name "hello"}) | |
(d/create-database {:db-name "hello"})) | |
(d/connect {:db-name "hello"})) | |
do-tx! (fn [s] (-> conn | |
(d/transact {:tx-data [{:db/ident :hello | |
:db/doc s} | |
{:db/id "datomic.tx" | |
:db/doc s}]}) | |
:tempids | |
(get "datomic.tx"))) | |
q! (fn [t] | |
(first (d/q '[:find ?doc :where [?e :db/ident :hello] [?e :db/doc ?doc]] | |
(d/as-of (d/db conn) t)))) | |
first-tx (do-tx! "first one") | |
second-tx (do-tx! "second one") | |
last-tx (do-tx! "last one")] | |
(q! last-tx) | |
(q! (dec last-tx))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment