Fork me on GitHub

Does anyone use anything other than UUIDs for :xt/id? Seems like everything else would require that I manage my own sequence of new IDs when inserting.


I have used maps to enforce unique constraints across multiple properties. I have also used other values when inserting data from another source that already has a primary key. No need to generate an ID since it's intrinsic to the data.

Steven Deobald19:08:46

I use UUIDs everywhere and would generally recommend that unless you have a constraint that pushes you to do something else.


yes, if there is a natural external id that is unique, usually use that


and I wrap the id as a single item map, so instead of {:xt/id #uuid …} it’s something like {:xt/id {:foo/id #uuid …}} where foo is the type of the entity


not that it makes a huge difference, it is just more convenient when seeing the data in repl or inspector that you know the “type” without needing to pull all of it

👍 1