This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-11
Channels
- # announcements (1)
- # babashka (132)
- # beginners (52)
- # calva (46)
- # clj-kondo (8)
- # cljdoc (17)
- # clojure (13)
- # clojure-australia (1)
- # clojure-dev (3)
- # clojure-europe (4)
- # clojurescript (4)
- # cloverage (1)
- # conjure (22)
- # datomic (9)
- # emacs (2)
- # fulcro (16)
- # leiningen (5)
- # malli (26)
- # off-topic (16)
- # pathom (3)
- # portal (5)
- # reagent (10)
- # reitit (5)
- # rewrite-clj (1)
- # ring (1)
- # shadow-cljs (14)
- # spacemacs (6)
- # tools-deps (10)
- # vim (11)
- # vscode (1)
- # xtdb (10)
is there a way to specify the union-path with a defresolver? i.e I want to do the union query on the value of the :type key and not some specific keys in the map
So if anyone is looking for a solution some day:
my problem was that not only I have a union query based on the value of a specific key :notification/type
, I also want to remove some of the results based on some of the values of some key (ie video/deleted?
, user/blocked?
)
I also want pagination, which I do using the following output:
[:pagination/edges [{:follow [:notification/type
:notification/timestamp
:user/id]
:comment [:notification/type
:notification/timestamp
:comment/text
:user/id
:video/id
:video/deleted?]...
:pagination/has-prev?
:pagination/has-next?
:pagination/first-cursor
:pagination/last-cursor]
so to achieve this I used 2 resolvers, one that outputs [{:notifications [:raw-notifications]}]
and one that outputs the schema above
the second resolver takes the raw-notifications as input and uses join-seq-parallel
to resolve the raw notifications so that the resolver can filter on the values
initially I wanted to use one resolver but for some reason I couldn't get join-seq-parallel
to work, I would get
[{:pagination/first-cursor :com.wsscode.pathom.core/not-found, :pagination/has-next? :com.wsscode.pathom.core/not-found, :pagination/last-cursor :com.wsscode.pathom.core/not-found, :pagination/has-prev? :com.wsscode.pathom.core/not-found, :pagination/edges :com.wsscode.pathom.core/not-found} {:pagination/first-cursor :com.wsscode.pathom.core/not-found, :pagination/has-next? :com.wsscode.pathom.core/not-found, :pagination/last-cursor :com.wsscode.pathom.core/not-found, :pagination/has-prev? :com.wsscode.pathom.core/not-found, :pagination/edges :com.wsscode.pathom.core/not-found} {:pagination/first-cursor :com.wsscode.pathom.core/not-found, :pagination/has-next? :com.wsscode.pathom.core/not-found, :pagination/last-cursor :com.wsscode.pathom.core/not-found, :pagination/has-prev? :com.wsscode.pathom.core/not-found, :pagination/edges :com.wsscode.pathom.core/not-found}]