This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-22
Channels
- # announcements (39)
- # architecture (9)
- # aws (2)
- # babashka (17)
- # beginners (73)
- # calva (6)
- # cider (27)
- # clj-kondo (140)
- # cljdoc (67)
- # cljsrn (1)
- # clojure (99)
- # clojure-dev (4)
- # clojure-europe (35)
- # clojure-nl (7)
- # clojure-spec (19)
- # clojure-uk (2)
- # clojurescript (40)
- # community-development (3)
- # cursive (10)
- # datalevin (2)
- # datavis (2)
- # datomic (27)
- # deps-new (5)
- # events (2)
- # fulcro (38)
- # integrant (6)
- # jobs (3)
- # keyboards (1)
- # leiningen (13)
- # lsp (3)
- # malli (10)
- # meander (5)
- # membrane (1)
- # membrane-term (9)
- # missionary (3)
- # off-topic (29)
- # polylith (3)
- # reagent (3)
- # reitit (5)
- # remote-jobs (2)
- # reveal (7)
- # shadow-cljs (20)
- # tools-build (4)
- # tools-deps (8)
- # vim (10)
- # xtdb (3)
Hi team XTDB, is there an established pattern for conditional queries? Say I have a function that finds all the sets given some key filter
(defn- find-all-sets
[repository {:keys [modality state id]}]
What would be the datalog that queries if the keys are non-nil? We have an implementation that conditionally builds the :where
clause but it is very verboseSpecifically that is:
(crux/q {:find '[(pull ?e [*])]
:in '[[?set-id ?modality ?state]]
:where (cond-> '[[?e :cohesic/type :reference-range-set]]
id (conj '[?e :crux.db/id ?set-id])
state (conj '[?e :reference-range-set/state ?state])
modality (conj '[?e :reference-range-set/modality ?modality]))}
[id modality state])
It would be good not to depend on the specific keys but I am passing a map in and can't depend on the order