Fork me on GitHub
#pathom
<
2019-03-26
>
souenzzo17:03:35

@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.

eoliphant18:03:41

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?

souenzzo18:03:01

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]}))

souenzzo18:03:02

then :>/my-placeholder can be any qualified keyword, that (#{">"} (namespace k)) return truth

Alex H18:03:16

@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]}]

Alex H18:03:08

the only thing you need is to specify that ::p/placeholder-prefix bit that @souenzzo mentioned

eoliphant18:03:12

right, I have the env-placeholder-reader, and prefix stuff setup in my parser.

eoliphant18:03:47

ah…. ok I think I misunderstood the proper usage.. So it’s like a ‘virtual’ key/node?

Alex H18:03:55

yep, it's just virtual hierachy

eoliphant18:03:01

ok ok got it

eoliphant18:03:15

thanks a mil guys