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

Support for uuidv7? #7

Open
rex-remind101 opened this issue Jun 26, 2023 · 5 comments
Open

Support for uuidv7? #7

rex-remind101 opened this issue Jun 26, 2023 · 5 comments
Assignees

Comments

@rex-remind101
Copy link

Thank you for building this library. May support be added for uuidv7?

@nthState-Chris
Copy link

I'd also love to see this feature

@karwa karwa self-assigned this Mar 28, 2024
@shaps80
Copy link

shaps80 commented Apr 26, 2024

I'd also like this! Also, @nthState-Chris funny finding you here? Hahaha

@nthState-Chris
Copy link

Hi @shaps80 great to hear from you! I hope you are well?
I actually wrote a small Swift Package to generate UUID V7 strings...it seems to work: https://github.com/nthState/UUIDV7

@karwa
Copy link
Owner

karwa commented Apr 26, 2024

The main issue is getting a good quality timestamp. IMO the spec is a little bit ambiguous, because the section on UUIDv7 says the timestamp should be:

the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded.

While other parts of the spec say that the timestamp only needs to be monotonic (BTW, Foundation's Date() initialiser does not make that guarantee), and that

This specification makes no requirement or guarantee about how close the clock value needs to be to the actual time

So it's unclear if we need to care about leap seconds or not. Previously I thought maybe we did, but now I'm leaning towards thinking that we don't (which is easier to implement, thankfully). One of the things on my to-do list is to send some feedback about that.

There are also a number of configuration options. The spec only requires the timestamp have millisecond precision, but there is another field for additional monotonic data, which may be the sub-millisecond portion of the timestamp, a counter, or some combination of the two. I'm debating how much of this to surface in the API; I always like exposing the knobs and dials so professionals can adjust the behaviour for their environment.

I have some other things going on which take priority, but I haven't forgotten about this and hope to get to it in a week or two (more likely two).

@shaps80
Copy link

shaps80 commented Apr 26, 2024

Yeah I can imagine its a little ambiguous. Appreciate you feeding back. Take your time, I know exactly how you feel haha!

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

No branches or pull requests

4 participants