Fork me on GitHub

Is it a good pattern to have a "entity_type" attribute to help differentiate types of entities?


it is a known pattern. in general it would be advisable to call it : or something else distinct


I use xtdb with fulcro and tend to duplicate the :xt/id into :foo/id where foo is the type


Thank you both! I also found a mention in faq: Modeling Types

Steven Deobald03:12:02

I realize my prodding is no doubt getting silly at this granularity, but @U3N4R4TLK if you are willing, it would be wonderful to have this question asked on, since it comes up reasonably often. It would be even more wonderful if @U3JH98J4R and/or @U49U72C4V could carbon copy their replies into Discourse. 😉 Apologies for the hassle and, as always, I completely understand if people don't want to do this. No obligation. 🙏

👍 1

here with my copy paste button ready

Nikolas Pafitis18:12:44

I know XTDB doesn't support unification on the attribute. Is it a good idea to pass an attribute "dynamically" while building the edn of the query? For example:

'{:find  [(pull ?e [*])]
  :in    [?value]
  :where [[?e ~attribute ?value]]}


I've had situations where that seemed perfectly reasonable to do. An attr's just another kind of data in the end, and if you want it to be parameterized, you need to do that

✔️ 2