Fork me on GitHub
#pathom
<
2020-11-04
>
souenzzo11:11:44

@lilactown I would like this:

(pc/defresolver pet-pull
  [_ _]
  {::pc/input #{:pet/id}
   ::pc/output [:pet/id :pet/name :pet/age ,,,]
  ...)
(pc/defresolver owner-pull
  [_ _]
  {::pc/input #{:owner/id}
   ::pc/output [:owner/id :owner/name :owner/age ,,,]}
  ...)
(pc/defresolver pet-owner
  [_ _]
  {::pc/input #{:pet/id}
   ::pc/output [:owner/id]}
  ...)

(pc/defresolver owner-pets
  [_ _]
  {::pc/input #{:owner/id}
   ::pc/output [{:owner/pets [:pet/id]}]}
  ...)

[{[:pet/id 123] 
  [:pet/id 
   :pet/name 
   {:>/owner [:owner/id
              :owner/name]}]}]

wilkerlucio14:11:55

@lilactown I would go close with @souenzzo suggestion, when you wrap the result in things like [{:pet [:pet/id :pet/name :pet/age ,,,]}] you miss out on some connection leverage between the attributes, because of the nesting

wilkerlucio14:11:37

but the alias is also a good option, and keeps the data easier to reason (you can see the alias going on)