This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-17
Channels
- # adventofcode (23)
- # announcements (2)
- # aws (11)
- # babashka (181)
- # beginners (59)
- # chestnut (2)
- # clj-kondo (9)
- # clojure (90)
- # clojure-brasil (2)
- # clojure-europe (18)
- # clojure-italy (24)
- # clojure-nl (9)
- # clojure-spec (3)
- # clojure-uk (28)
- # clojured (4)
- # clojuredesign-podcast (3)
- # clojurescript (12)
- # community-development (49)
- # core-async (49)
- # cryogen (5)
- # cursive (16)
- # data-science (1)
- # datascript (7)
- # datomic (54)
- # defnpodcast (4)
- # events (2)
- # figwheel-main (14)
- # fulcro (139)
- # graphql (1)
- # jobs-discuss (6)
- # kaocha (1)
- # luminus (2)
- # malli (3)
- # music (1)
- # off-topic (34)
- # pathom (24)
- # re-frame (13)
- # reitit (5)
- # shadow-cljs (8)
- # test-check (6)
I find myself called (ds/entity ...)
a lot... is there a way to return an entity or a set of entities from a query directly?
@samcferrell you can use pull
in the find specification of a query, for example:
[:find (pull ?e [:artist/startYear :artist/endYear])
:where [?e :artist/name "The Beatles"]]
You can get something similar to ds/entity
by using a wildcard in the pull expression:
[:find (pull ?e [*])
:where [?e :artist/name "The Beatles"]]
Couple differences tho. entity
is lazy, and can be used with functions like get-in
to “walk” edges. pull
is eager, and *
won’t actually bring in the “edge entities” on its own.
@cjsauer thanks for explain in detail! I did not realize that I can use this [:user/id 1]
format as a value! It's this a new feature in recent updates?
@doglooksgood no it isn’t new. Lookup refs are a primary feature, likely inspired by datomic.