Fork me on GitHub
#pathom
<
2019-02-01
>
wilkerlucio01:02:17

[com.wsscode/pathom "2.2.9"] is out! For everyone using Pathom I highly suggest to upgrade, this version has some fixes we encountered recently to calculate paths on some complex situations (where it goes from one to many and back, hard to explain but better have it working properly). This also adds p/pre-process-plugin.

wilkerlucio01:02:47

@ecaspary welcome 🙂 about recursive queries, yes they are supported, there is not much you have to do, they should work out of the box even you a valid recursive link in your resolvers, your example looks almost correct, but the :node/neighbors will not work that way

wilkerlucio01:02:01

it can be fixed using:

wilkerlucio01:02:24

(def mock-db
  {:node/id {0 {:node/id 0 :node/mass 0.00 :node/neighbors [{:node/id 1}]}
             1 {:node/id 1 :node/mass 1.11 :node/neighbors [{:node/id 2}]}
             2 {:node/id 2 :node/mass 2.22 :node/neighbors [{:node/id 3}]}
             3 {:node/id 3 :node/mass 3.33 :node/neighbors [{:node/id 0}]}}})

wilkerlucio01:02:36

so the elements are now maps that represent a context, pathom can pick up on that

wilkerlucio01:02:52

if I may, you could start simpler to experiment using to-one connections, might be easier to understand at first, to be honest I dont remember trying recursion to many like this

wilkerlucio01:02:43

I just tried running it, it works for to-one, but not for to-many, I'm interesting to hear about your case on recursive queries to-many, are those valid in datascript?

wilkerlucio01:02:04

so, this works with this mock data:

wilkerlucio01:02:08

(def mock-db
  {:node/id {0 {:node/id 0 :node/mass 0.00 :node/neighbors {:node/id 1}}
             1 {:node/id 1 :node/mass 1.11 :node/neighbors {:node/id 2}}
             2 {:node/id 2 :node/mass 2.22 :node/neighbors {:node/id 3}}
             3 {:node/id 3 :node/mass 3.33 :node/neighbors {:node/id 0}}}})

wilkerlucio01:02:25

but :node/parent would be a better link name in this case

danielstockton13:02:12

Is walkable a somewhat vetted and recommended way of dealing with sql + pathom?

wilkerlucio15:02:47

@danielstockton what you mean by vetted?

wilkerlucio15:02:58

walkable works fine with pathom, but Walkable doesn't support connect at this stage, so mixing those things don't work well

danielstockton15:02:00

Just wondering if those that use pathom usually use walkable, and if the two projects are fairly well in agreement (or if there are contentions or overlap)

danielstockton15:02:38

If they're likely to diverge or significantly overlap, i'd rather pick one

wilkerlucio15:02:41

I personally thing the connect infrastructure is what enables the things I create to grow, scale and connect across different sources, but it will depend on the use case, if you have just a lot of SQL maybe use Wakable, but you can use connect and just write resolvers that use some SQL library, and with that you get all the connect features (path resolution, tracer, auto-complete...)

wilkerlucio15:02:09

would be great if Wakable did support connect, it could be done, it needs to generate proper connect indexes, and then you could mix both things

danielstockton15:02:42

Understood, answers all my questions, thanks

👍 5