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

Allows setting an explicit timestamp when generating a UUIDv7 #143

Merged
merged 1 commit into from
Dec 8, 2024

Conversation

umeldt
Copy link
Contributor

@umeldt umeldt commented Dec 8, 2024

Providing the number of seconds since the UNIX epoch as the first argument to uuid7() creates a UUIDv7 from that timestamp instead of the default current time:

sqlite> .load dist/uuid
sqlite> select uuid7(0);
00000000-0000-7a9f-8e13-8c7852c6ea51
sqlite> select uuid7(1733668387);
0193a6b0-38b8-7762-9ca0-048beb946261

Not sure if this is too much of a niche use-case, but I've seem similar functionality in other libraries that implement UUIDv7.

@umeldt umeldt changed the title Allows setting an explicit timestamp (as seconds from epoch) when creating a UUIDv7 timestamp Allows setting an explicit timestamp when creating a UUIDv7 timestamp Dec 8, 2024
@umeldt umeldt changed the title Allows setting an explicit timestamp when creating a UUIDv7 timestamp Allows setting an explicit timestamp when creating a UUIDv7 Dec 8, 2024
@umeldt umeldt changed the title Allows setting an explicit timestamp when creating a UUIDv7 Allows setting an explicit timestamp when generating a UUIDv7 Dec 8, 2024
@nalgeon nalgeon merged commit ac10ca6 into nalgeon:main Dec 8, 2024
1 of 3 checks passed
@nalgeon
Copy link
Owner

nalgeon commented Dec 8, 2024

Thanks!

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