Fork me on GitHub
#pathom
<
2021-07-31
>
wei07:07:13

when writing pathom resolvers for datomic, is it better to key on the primary key (e.g. uuid) or the internal db/id ? what if the entity has a composite primary key, is it ok to key off that?

markaddleman14:07:54

I'm curious what others have to say. In my experience, I prefer not to expose internal IDs so I would avoid the datomic I'd and use the generated uuid

markaddleman14:07:07

Composite keys are interesting. You can certainly model them using Pathom. There is some question around how to expose that data in external facing Pathom API

wei07:08:04

great, thanks for the feedback. think i'll go with uuid.

eoliphant16:08:22

+1 for domain/biz/etc id’s instead of :db/id. Pathom and Datomic are a match made in heaven, EQL all the way down (more or less), but :db/id’s have always felt a little leaky to me

lgessler17:07:07

Is there a way to ask pathom to give me "everything" that can be reached via joins on a certain entity? E.g, if I have an entity type a with :a/b as a join, and b with b/c as a join, I'd want results like {[:a/id ...] {:a/id ... :a/b {:b/id ... :b/c {...}}}} given a query like [{[:a/id ...] ???}] . I feel silly asking, since I know pathom's all about specific queries yielding specific data, but I'm feeling lazy

lgessler17:07:19

I know the * special query symbol is available for a particular entity, i guess i'm looking for a recursive version of that

lilactown18:07:49

you could try:

[{[:a/id 1] [* {:a/b [* {:b/c [*]}]}]}]

👍 2
lilactown18:07:08

I think fundamentally pathom will not traverse joins unless explicitly asked

lgessler19:07:20

yeah... the problem here is that I have joins of unknown depth/type. No biggie, I should just write some code 🙂

wilkerlucio18:08:11

no feature for that yet, in Pathom 3, a good way to explore data you don't know is using smart maps + datafy

👍 2
wilkerlucio18:08:33

if you do this combo, you can use tools like Portal, Reveal or REBL to navigate the structure

👍 2
wilkerlucio18:08:49

is your usage for exploration or to make something prod-like?

lgessler20:08:27

prod-like: there's a tree I want to emit that has an unknown (user-created) structure. I think I wanted this facility to help me tinker with stuff in the REPL while I'm developing without writing a giant EQL query, but for actual prod code I don't think this is something I need, and for dev I can just write a function in my dev ns to help with the query

nivekuil22:07:25

@wilkerlucio is https://github.com/wilkerlucio/log meant for public use? going to polish up and release my pathom-based depenedncy injection framework, think it's pretty good at this point and was wondering if I can make use of this

wilkerlucio18:08:02

hello, feel free to use, I'm not decided if I'm going to continue or not this library, but so far I see no other option for map-driven logs that works on both CLJ and CLJS, would love to use mulog, but it doesn't work in CLJS

3