This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-31
Channels
- # aleph (3)
- # aws (5)
- # beginners (65)
- # boot (17)
- # cljs-dev (112)
- # cljsrn (5)
- # clojure (146)
- # clojure-austin (3)
- # clojure-dusseldorf (3)
- # clojure-italy (18)
- # clojure-norway (13)
- # clojure-russia (84)
- # clojure-serbia (5)
- # clojure-spec (24)
- # clojure-uk (84)
- # clojurescript (204)
- # css (1)
- # cursive (21)
- # data-science (3)
- # datascript (21)
- # datomic (26)
- # emacs (5)
- # euroclojure (1)
- # hoplon (8)
- # jobs (7)
- # jobs-discuss (2)
- # keechma (35)
- # lumo (92)
- # mount (1)
- # nrepl (2)
- # numerical-computing (16)
- # off-topic (10)
- # om (58)
- # re-frame (13)
- # reagent (90)
- # remote-jobs (2)
- # ring-swagger (1)
- # spacemacs (9)
- # specter (6)
- # unrepl (17)
- # untangled (56)
- # yada (2)
Is it possible to pass a _
as an input in a parameterized query?
@ezmiller77 can you be more concrete? You want [:in $ _ ]
? or a symbol _ as a value?
first is probably no, but I'm not sure why you would want to do that. Second is definitely yes.
@favila: More like :in $ ?type
, where ?type
is a wildcard _
from the input arg passed to the query fn when I want not to filter the results. Because the only other way I know to get all is to construct a separate query.
Ah. No that is essentially the "nil" case. You must construct a separate query. I use cond->
when I create the clauses
(defn q-users [db user-id]
{:query {:find '[[?e ...]]
:in (cond-> '[$]
user-id (conj '?id))
:where (cond-> []
user-id (conj '[?e :user/id ?id])
(not user-id) (conj '[?e :user/id]))}
:input (cond-> [db]
user-id (conj user-id))})
@ezmiller77 what's wrong with separate query?
is there a way to sort entities by creation date w/o storing some extra :e/created-date attribute value? is sorting by id good enough proxy for this? say, I have event, with a collection of subevents. actual dates of subevents are not important, but order of creation is (e.g. for further reduction).
use case example would be order of operations: 100% -10 -20% is not the same as 100% -20% -10 (72 vs 70)
entity ids will always be larger if they are newer @misha
@robert-stuttaford will ids (order) be preserved during built-in backup/restore?
Ah. No that is essentially the "nil" case. You must construct a separate query. I use cond->
when I create the clauses