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

Added support for generating UUID version 8 for a specific time #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SidorkinAlex
Copy link

@SidorkinAlex SidorkinAlex commented Nov 14, 2024

``Added support for generating UUID version 8 for a specific time, as well as for retrieving the first and last UUID version 8 for a given time interval. This enhancement allows the use of UUID filtering instead of time filtering, which can, in some cases, eliminate the need for additional indexes in the data structure and even the need for extra columns in additional tables.

$firstDate = \DateTime::createFromFormat('Y-m-d H:i:s.u', '2024-01-01 13:12:12.129817');
$uuid8_from_date = UUID::uuid8($firstDate);
$uuid8_zero_value = UUID::firstUuid8($firstDate) // 018cc527-3c61-8d12-9000-000000000000 first uuid from this time
$uuid8_last_value = UUID::lastUuid8($firstDate) //  018cc527-3c61-8d12-9fff-ffffffffffff last uuid from this time
var_dump(($uuid8_zero_value < $uuid8_from_date) && ($uuid8_from_date < $uuid8_last_value)); // bool(true)
```

…ell as for retrieving the first and last UUID version 8 for a given time interval. This enhancement allows the use of UUID filtering instead of time filtering, which can, in some cases, eliminate the need for additional indexes in the data structure and even the need for extra columns in additional tables.
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.

1 participant