Skip to content

Instantly share code, notes, and snippets.

@souenzzo
Last active May 10, 2019
Embed
What would you like to do?
(let [register (pc/resolver `smart-pull
;;maybe not so smart
{::pc/output [:user/foo
:user/bar]}
(fn [{::p/keys [parent-query]} _]
;; I'm using a d/pull with (eql/focus-subquery output parent-query)
;; if you return data, it will work
(let [data {:user/id 1
:user/foo :foo
:user/bar :bar}
return (p/map-select data parent-query)]
;; it will return just what it's asked for.
(prn {:return return
:ask parent-query})
#_data
return)))
ctx {::p/reader [pc/reader2
p/env-placeholder-reader]
::p/plugins [(pc/connect-plugin {::pc/register register})]
::p/placeholder-prefixes #{">"}}
parser (p/parser ctx)]
(parser ctx `[{:>/a [:user/foo]}
{:>/b [:user/bar]}]))
#_=>
{:>/a {:user/foo :foo}
:>/b {:user/bar :com.wsscode.pathom.core/not-found}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment