Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for UUID Version 8 (RFC 9562) #178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ashwingopalsamy
Copy link

Changes

This adds support for generating UUID Version 8 as defined in RFC 9562. UUIDv8 is designed for custom or experimental use cases, allowing you to embed application-specific data while adhering to standard version and variant bits.

What’s included:

  • NewV8(): Generates a UUIDv8 with random values.
  • NewV8FromReader(customA, customB, r): Allows custom values for custom_a (48 bits) and custom_b (12 bits) while custom_c field (62 bits) is filled using a random source or secure fallback.
  • NewV8TimeBased(r): A time-based variant of UUIDv8 that uses the current timestamp for custom_a. It also includes a sequence number to ensure uniqueness when multiple UUIDs are generated in the same nanosecond.

This addition completes support for all UUID versions in RFC 9562. Looking forward for your feedback, team!

@ashwingopalsamy ashwingopalsamy requested a review from a team as a code owner December 14, 2024 08:15
Copy link
Author

@ashwingopalsamy ashwingopalsamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bormanp, apologies for the noise! I’d really appreciate it if you could take a look at this proposal when you have a moment. Thanks in advance! 🙏

@vtolstov
Copy link

any news ? uuid v8 really useful when need to store in db and have ordered records with uniq node id

@ashwingopalsamy
Copy link
Author

hi team, would appreciate your eyes on this proposal.

@quartzmo / @bormanp / @noahdietz :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants