I wonder if we can use some bits in the uuid v7 to encode the entity type (like id of a change vs id of a snapshot) - In a former project we used some of the machine id bits in snowflake to signal the type of the id. This allowed us to runtime assert correct entities early based on passed id's - saved us hours, if not days of debugging and post mortems.
Not the solution - and I need into uuid v7 but to outline what I have in mind:
If every id of a change must end with a C 40e97286-9b78-4a35-8fb1-0036bdfbbf7C
Every id of a snapshot ends with an S 40e97286-9b78-4a35-8fb1-0036bdfbbf7S
Context
I wonder if we can use some bits in the uuid v7 to encode the entity type (like id of a change vs id of a snapshot) - In a former project we used some of the machine id bits in snowflake to signal the type of the id. This allowed us to runtime assert correct entities early based on passed id's - saved us hours, if not days of debugging and post mortems.
Not the solution - and I need into uuid v7 but to outline what I have in mind:
If every id of a change must end with a C
40e97286-9b78-4a35-8fb1-0036bdfbbf7C
Every id of a snapshot ends with an S
40e97286-9b78-4a35-8fb1-0036bdfbbf7S
….
Compare https://github.com/opral/monorepo/pull/3170#discussion_r1802421075
Proposal