This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-11
Channels
- # aws (3)
- # babashka (67)
- # beginners (284)
- # calva (19)
- # cider (12)
- # cljdoc (9)
- # clojure (111)
- # clojure-austin (4)
- # clojure-europe (34)
- # clojure-france (12)
- # clojure-greece (2)
- # clojure-nl (14)
- # clojure-taiwan (2)
- # clojure-uk (11)
- # clojurescript (34)
- # community-development (2)
- # conjure (8)
- # datomic (15)
- # events (3)
- # fulcro (12)
- # jobs (3)
- # leiningen (4)
- # malli (3)
- # meander (11)
- # mount (2)
- # off-topic (29)
- # pathom (11)
- # re-frame (31)
- # reagent (19)
- # remote-jobs (3)
- # reveal (8)
- # rewrite-clj (1)
- # sci (1)
- # shadow-cljs (8)
- # spacemacs (4)
- # sql (1)
- # startup-in-a-month (2)
- # tools-deps (2)
- # vim (7)
- # xtdb (6)
New docs section on using Recursive queries with EQL on Pathom 3: https://pathom3.wsscode.com/docs/eql/#recursive-queries


Have you given any thought to multimethod-like dispatch for resolvers? For example, I might have a compute-cost
resolver that dispatches based on an input parameter product/type
to resolvers compute-book-cost
and compute-fish-cost
that have different inputs. I can see how I might use optional inputs to achieve the desired result but that approach seems a little messy.
not sure if I understand the issue, you can already have multiple options for the same value (multiple resolvers with same output, different input), with different dependencies. can you make an example?
I have a use case of two resolvers taking different inputs and producing the same output.
When the inputs for resolver A are satisfied, I'd like Pathom to execute that resolver. When the inputs for resolver B are satisfied, obviously execute the other.
I can see a way to implement this in Pathom 3 using optional inputs but it seems a little messy.
you don't need optional input, just make 2 resolvers with the same output, the exact thing you described is what pathom does
code in Pathom 3 (but works the same in Pathom 2):
(pco/defresolver c-from-a [{:keys [a]}]
{:c (str a "A")})
(pco/defresolver c-from-b [{:keys [b]}]
{:c (str b "B")})
(def paths-env (pci/register [c-from-a c-from-b]))
(p.eql/process paths-env {:a 1} [:c])
=> {:c "1A"}
(p.eql/process paths-env {:b 2} [:c])
=> {:c "2B"}