Fork me on GitHub
#pathom
<
2021-08-19
>
Drew Verlee21:08:42

greetings, i'm reading the wonderful written documentation for pathom3 and evaling some examples in my editor and i seem to have hit a snag. https://pathom3.wsscode.com/docs/resolvers/#parameters talks about (pf.eql/process env [::todos]) And i'm told that alias is this: [com.wsscode.pathom3.format.eql :as pf.eql] However i can't seem to find that function. I'm on the latest commit 6e8fa2

Drew Verlee22:08:39

is it supposed to be one of the other eql namespaces?

Drew Verlee22:08:31

just p.eql/process maybe?

Drew Verlee22:08:31

that seems to do the trick.

Drew Verlee22:08:57

if someone can point out where i should submit documentation changes ill be happy to note it there 🙂

wilkerlucio23:08:22

sorry, I see that too late, but at the end of all documentation pages there is a link to "Edit this page", you can use that to send edits

wilkerlucio23:08:24

hello, @drewverlee ups, that example is wrong, it should be p.eql/process, from com.wsscode.pathom3.interfaces.eql

wilkerlucio23:08:27

going to fix that now

Drew Verlee23:08:06

So this mock example works the way i would hope

(def mock-todos-db
  [{::todo-message "Write demo on params"
    ::todo-done?   true}
   {::todo-message "Pathom in Rust"
    ::todo-done?   false}])

(pco/defresolver todos-resolver [env _]
  {::pco/output
   [{::todos
     [::todo-message
      ::todo-done?]}]}

  {::todos
   ;; pull params and filter
   (if-some [letter (get (pco/params env) ::letter)]
     (->> mock-todos-db
          (filter #(str/includes? (::todo-message %) letter)))
     mock-todos-db)})


(def env (pci/register todos-resolver))

(def sm2 (psm/smart-map env {}))


(p.eql/process env
               '[(::todos {::letter "x"})])
But it doesn't work for a more complex example because I don't now how to structure the eql correctly I suppose. Some simple questions: 1. where would i read more about the syntax for [(::todos {::letter "x"})] E.g i assume ::todos patches to the defresolver top level map key, this is EQL? 2. what does the :> syntax mean? 3. Is pco output always a vector? Is that to allow for multiple root/maps? I'm reading the docs know. I'll try to answer my own simple questions as I have time ;).

wilkerlucio02:08:15

no worries 1. you can read about the syntax at: https://edn-query-language.org/eql/1.0.0/specification.html#_parameters 2. Placeholders: https://pathom3.wsscode.com/docs/placeholders 3. yes, always a vector, a EQL more specifically, and the resolver output is always a map (*both things change in case of batch resolvers)

wilkerlucio02:08:59

can you give more details about the more complex example you are trying?

wilkerlucio02:08:30

ps: on your demo, better use filterv, lazy sequences may cause strange trace behavior (due due to when the item collections get evaluated)