Closed oliver-sturrock closed 4 months ago
WIP
@oliver-sturrock https://github.com/DevToys-app/DevToys.Tools/pull/45
The value of rand_a
is a random number, not a ticks value or a counter value.
https://datatracker.ietf.org/doc/html/rfc9562#monotonicity_counters
Agreed, but section 5.7 states that "UUIDv7 values are created by allocating a Unix timestamp in milliseconds in the most significant 48 bits and filling the remaining 74 bits, excluding the required version and variant bits, with random bits for each new UUIDv7 generated to provide uniqueness as per Section 6.9. Alternatively, implementations MAY fill the 74 bits, jointly, with a combination of the following subfields, in this order from the most significant bits to the least, to guarantee additional monotonicity within a millisecond", so both monotonicity and usable millisecond-accurate timestamps are achieved.
At the moment, DevToys' UUIDTool repeats a single output n times without considering the number of pieces needed. What changes would you suggest be made in adding UUIDv7? I think there are a few ways.
Additional information is needed, such as the environment in which DevToys is running, and how the output UUID will be used.
Being able to provide many UUIDs per ms shouldn't be a problem, since there is still a random part that should ensure uniqueness. It would be good if the output were monotonically increasing in value. Can you generate and sort?
My use case is for creating UUIDs during development of test data, but there may be other uses I didn't think about.
Thanks. As for sorting the UUIDs, this can be solved by using this tool in combination with a text analyzer tool.
https://github.com/DevToys-app/DevToys/assets/2970321/63365f93-44a9-4f61-882c-49f1fca09a0c
What improvement do you think would an existing feature or tool in DevToys?
We are transitioning to V7 UUIDs for better indexing in database primary keys. V7 UUIDs are the same format as V4 but use microseconds since epoch for the first 48 bits giving time-ordered creation sequence and improved partitioning when used as keys.
Solution/Idea
Add UUID v7 to the version dropdown and use a UUID generator function that supports V7 to generate.
Comments
No response