Fork me on GitHub
#pathom
<
2020-07-21
>
tvaughan21:07:53

What's the canonical way to query for enums in EQL/Pathom? If I have a schema like:

{:db/ident :document/status
  :db/valueType :db.type/ref
  :db/cardinality :db.cardinality/one}
 {:db/ident :document.status/draft}
 {:db/ident :document.status/final}
A query for [:document/status] returns :document/status {:db/id 17592186045468}. I know that with Pathom it's recommend to have separate id's for entities, like :document/id, :person/id, etc. which I do have elsewhere. But entities like these aren't enumerated entities. If there's an EQL compatible way to query for the keyword, I haven't found it. Any help is appreciated. Thanks

eoliphant21:07:51

this isn’t really a ‘pure’ pathom thing per-se. Just has to do with the fact that while EQL/Pathom are very close, there isn’t always 1-to-1 correspondence with Datomic. so you can either roll your own resolvers for your enum attrs that return the :db/ident value, or check out pathom-datomic that has some special sauce to make this easier. basically you give it your enum attributes at config time, and it does what I described for you

tvaughan21:07:22

Right, I knew I was conflating the two. Sorry for any confusion. Thanks @eoliphant. I'll check-out pathom-datomic

eoliphant21:07:05

ah no, not at all. if you can use Datomic in your app, it with Pathom is a match made in heaven lol. Just little stuff like that you have to be aware of. And things just got a bit better with some of the new datomic apis that were just released. qseq and index-pull

tvaughan21:07:07

Cool. Thanks again!