Created
November 22, 2014 01:52
-
-
Save claytantor/b75540e765540c775994 to your computer and use it in GitHub Desktop.
diatomic hello world
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
[ec2-user@ip-10-65-176-236 datomic-free-0.9.5067]$ bin/groovysh | |
Nov 22, 2014 1:45:44 AM java.util.prefs.FileSystemPreferences$2 run | |
INFO: Created user preferences directory. | |
Groovy Shell (1.8.9, JVM: 1.6.0_33) | |
Type 'help' or '\h' for help. | |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
groovy:000> import datomic.Peer | |
import datomic.Peer | |
===> [import datomic.Peer] | |
groovy:000> uri = "datomic:mem://hello" | |
uri = "datomic:mem://hello" | |
===> datomic:mem://hello | |
groovy:000> Peer.createDatabase(uri) | |
Peer.createDatabase(uri) | |
===> true | |
groovy:000> conn = Peer.connect(uri) | |
conn = Peer.connect(uri) | |
===> datomic.peer.LocalConnection@55ed98f8 | |
groovy:000> datom = ["db/add", Peer.tempid("db.part/user"), | |
datom = ["db/add", Peer.tempid("db.part/user"), | |
groovy:001> "db/doc", "hello world"] | |
"db/doc", "hello world"] | |
===> [db/add, #db/id[db.part/user -1000000], db/doc, hello world] | |
groovy:000> resp = conn.transact([datom]) | |
resp = conn.transact([datom]) | |
===> #<Future: {:db-before datomic.db.Db@fe24ada7, :db-after datomic.db.Db@1e5ac50d, :tx-data [#datom[13194139534312 50 #inst "2014-11-22T01:47:14.292-00:00" 13194139534312 true] #datom[17592186045417 62 "hello world" 13194139534312 true]], :tempids {-9223350046623220288 17592186045417}}> | |
groovy:000> db = conn.db() | |
db = conn.db() | |
===> datomic.db.Db@1e5ac50d | |
groovy:000> Peer.q("[:find ?entity :where [?entity :db/doc \"hello world\"]]", | |
Peer.q("[:find ?entity :where [?entity :db/doc \"hello world\"]]", | |
groovy:001> db) | |
db) | |
===> [[17592186045417]] | |
groovy:000> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment