How to model entity type?

I’m partial to using a map with a single key as :xt/id

So instead of having, {:xt/id #uuid "..."} you would have {:xt/id {:company/id #uuid "..."}}. That makes the types of entities very clear when navigating the database (for example in XTDB inspector).

It doesn’t help with queries like “list all companies”, but I usually handle those by using some required attribute that only that type of entity. (eg. where clause [?e :company/name])

2 Likes