This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-26
Channels
- # announcements (6)
- # beginners (51)
- # cider (3)
- # cljsrn (9)
- # clojure (4)
- # clojure-argentina (1)
- # clojure-houston (2)
- # clojure-italy (5)
- # clojure-nl (1)
- # clojure-spec (14)
- # clojurescript (17)
- # community-development (2)
- # cursive (53)
- # datomic (69)
- # fulcro (5)
- # graphql (15)
- # immutant (6)
- # jobs (2)
- # kaocha (1)
- # leiningen (15)
- # lumo (5)
- # midje (1)
- # nrepl (6)
- # off-topic (119)
- # pathom (11)
- # tools-deps (5)
@eoliphant the resolver knows nothing about placeholder.
if the query [{[:user/id 33] [:user/id :user/name]}]
works, then the query [{[:user/id 33] [:user/id {:>/my-placeholder [:user/name]}]}]
should work too.
Hi @souenzzo, thanks, so I guess what I’m missing is, how do I ‘do/return something’ based on :>/my-placeholder
? Do I create a plugin or something?
You need to include the plugin in your parser somethign like this
(def parser
(p/parallel-parser
{::p/env {::p/reader [p/map-reader
pc/all-parallel-readers
p/env-placeholder-reader]
::p/placeholder-prefixes #{">"}}
::p/mutate pc/mutate-async
::p/plugins [(pc/connect-plugin {::pc/register my-registers})
p/error-handler-plugin]}))
then :>/my-placeholder
can be any qualified keyword, that (#{">"} (namespace k))
return truth
@eoliphant if you e.g. have a resolver that provides some :foo/*
keys as well as a :user/id
key, for example, And another resolver that provides :user/*
given :user/id
, you can either do a query along the lines of [:foo/a :foo/b :user/x :user/y]
, or you could e.g. use a placeholder like so, to build a bit of hierarchy: [:foo/a :foo/b {:>/user [:user/id :user/x :user/y]}]
the only thing you need is to specify that ::p/placeholder-prefix
bit that @souenzzo mentioned