This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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