Fork me on GitHub
#datomic
<
2015-11-10
>
bostonaholic00:11:53

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)

bostonaholic00:11:01

1) retrieve the datoms then pull the attributes you want OR 2) query for entities and use pull from within the query

nha14:11:34

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 ?

nha14:11:11

@cmcfarlen: ah thanks I was looking for a different name.

cmcfarlen14:11:36

you'll have to transact your schema data before you can add a user

nha14:11:34

I understood that there was something like that, yes. I will play a bit now simple_smile

nha14:11:55

Just found this : https://gist.github.com/stuarthalloway/2948756 looks like it is going to help

nha14:11:19

what do these mean ? : #db/id[:db.part/db]

bostonaholic14:11:38

it's basically saying "create a temporary id in the :db.part/db partition"

marshall14:11:49

@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

marshall14:11:10

The other examples in the same tutorial directory show various other techniques and features

nha14:11:08

@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.

marshall14:11:21

the Seattle tutorial is available in Clojure in the Datomic distro you downloaded under samples/seattle/getting-started.clj

nha14:11:21

Ok great that should get me started simple_smile