This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-22
Channels
- # announcements (2)
- # aws (5)
- # babashka (17)
- # beginners (108)
- # calva (28)
- # chlorine-clover (7)
- # clj-kondo (14)
- # cljs-dev (9)
- # cljsrn (2)
- # clojure (118)
- # clojure-europe (50)
- # clojure-finland (5)
- # clojure-france (15)
- # clojure-italy (9)
- # clojure-nl (14)
- # clojure-spec (11)
- # clojure-uk (43)
- # clojuredesign-podcast (1)
- # clojurescript (35)
- # clojutre (2)
- # clr (3)
- # community-development (6)
- # conjure (9)
- # core-async (41)
- # cursive (7)
- # data-science (7)
- # datomic (11)
- # events (1)
- # figwheel-main (4)
- # fulcro (20)
- # ghostwheel (9)
- # graalvm (18)
- # helix (46)
- # leiningen (14)
- # observability (2)
- # off-topic (23)
- # pathom (4)
- # re-frame (5)
- # reitit (5)
- # rum (2)
- # shadow-cljs (32)
- # spacemacs (8)
- # specter (5)
- # sql (36)
- # timbre (3)
- # vim (15)
- # xtdb (2)
- # yada (2)
I'm on my pathom learning journey and am running into a problem that makes me think I'm missing some fundamental concept. In the docs, there's the latest-product
resolver. I want to extend that to take an input and return a list of products. For example, I want to provide a store id and return the list of latest products for that store.
Here are the resolver and query that don't work. What am I doing wrong?
(pc/defresolver latest-products-for-store [_ {::keys [store]}]
{::pc/input [::store]
::pc/output [{::store [:product/id :product/title :product/price]}]}
(condp = store
0 {[::store 0] [{:product/id 1
:product/title "Acoustic Guitar"
:product/price 199.99M}
{:product/id 2
:product/title "Piano"
:product/price 99.99M}]}
1 {[::store 1] [{:product/id 3
:product/title "Clavachord"
:product/price 199.99M}
{:product/id 4
:product/title "Didgeridoo"
:product/price 990.99M}]}))
query:
[{[::store 1] [:product/id]}]
typo in my example the ::pc/input
ought to be a set instead of a vector. That doesn't change the result. The parser still returns not found
I found the issue: The output attribute is the same name as the input attribute (ie ::store
) Of course, that makes no sense