This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-10
Channels
- # alda (28)
- # announcements (7)
- # beginners (79)
- # boot (62)
- # cider (11)
- # cljsjs (12)
- # cljsrn (8)
- # clojure (111)
- # clojure-art (2)
- # clojure-austin (5)
- # clojure-conj (3)
- # clojure-dev (54)
- # clojure-japan (12)
- # clojure-russia (30)
- # clojurescript (354)
- # clojurex (5)
- # cursive (9)
- # data-science (58)
- # datomic (19)
- # editors-rus (3)
- # emacs (7)
- # events (2)
- # hoplon (5)
- # ldnclj (6)
- # lein-figwheel (14)
- # luminus (1)
- # off-topic (10)
- # om (191)
- # onyx (59)
- # re-frame (30)
- # reagent (74)
- # robots (1)
- # yada (19)
which method do you find yourself using?
;; 1
(map (comp (partial d/pull db [:account/number :account/date])
:e)
(d/datoms db :aevt :account/number))
;; 2
(d/q '[:find [(pull ?account [:account/number :account/date]) ...]
:where [?account :account/number]]
db)
1) retrieve the datoms then pull
the attributes you want OR
2) query for entities and use pull
from within the query
@bostonaholic: easily both
I'm taking baby steps in datomic... all the examples I have seen so far fill data from a file, and I am not sure how to use db/add
to add data. Here is what I have so far : https://www.refheap.com/111536 now how would I go about adding a user ?
@cmcfarlen: ah thanks I was looking for a different name.
Just found this : https://gist.github.com/stuarthalloway/2948756 looks like it is going to help
@nha it's an "edn tagged data literal". see http://docs.datomic.com/data-structure-literals.html and https://github.com/edn-format/edn#tagged-elements
it's basically saying "create a temporary id in the :db.part/db
partition"
@nha: You might want to look at the Day-Of-Datomic examples. The “Hello World” example shows a creating a very minimal transaction: https://github.com/Datomic/day-of-datomic/blob/master/tutorial/hello_world.clj
The other examples in the same tutorial directory show various other techniques and features
@bostonaholic: thanks I did not know about EDN tagged. @marshall: Alright I probably have to start there. I glanced through the official tutorial, but it did not seem to target Clojure users.
the Seattle tutorial is available in Clojure in the Datomic distro you downloaded under samples/seattle/getting-started.clj
@nha can’t recommend http://www.datomic.com/training.html enough