Fork me on GitHub
#xtdb
<
2021-12-19
>
match3703:12:57

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

emccue03:12:39

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

lgessler03:12:16

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

match3703:12:02

Thank you both! I also found a mention in faq: Modeling Types https://docs.xtdb.com/resources/faq/

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 http://discuss.xtdb.com, 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
emccue03:12:02

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]]}

lgessler18:12:29

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
1