January 2018
Intermediate to advanced
336 pages
7h 56m
English
Datomic offers two ways to retrieve the data from the database—pull (http://docs.datomic.com/pull.html) and query (http://docs.datomic.com/query.html). The query method of retrieving facts from Datomic databases uses an extended form of Datalog (https://en.wikipedia.org/wiki/Datalog). To query the database, the q function of datomic.api needs to know the state of the database to run the query on. The current state of the database can be retrieved using the db function of datomic.api. Take a look at the following example:
pedestal-play.server> (d/q '[:find ?e ?n ?c ?s :where [?e :order/rating 5] [?e :order/name ?n] [?e :order/contact ?c] [?e :order/status ?s]] (d/db conn))#{[1 "Cleaning Order" "abc@hh.com" "Done"]}Read now
Unlock full access