Created
July 5, 2012 17:58
-
-
Save martintrojer/3055238 to your computer and use it in GitHub Desktop.
datomic
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
(ns tut.hello | |
(:use [datomic.api :only [db q] :as d])) | |
(defn add-get-user [uri] | |
(d/create-database uri) | |
(let [conn (d/connect uri) | |
dbase (d/db conn)] | |
(d/transact conn [{:db/id #db/id [:db.part/user] | |
:db/doc "Hello World!"}]) | |
(->> | |
(q '[:find ?e :where [?e :db/doc "Hello World!"]] | |
dbase conn) | |
(map #(d/entity dbase (first %))) | |
(map (juxt :db/id :db/doc)) | |
))) | |
(add-get-user "datomic:mem://test") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment