uuid
uuid copied to clipboard
Allow to use something different than `time.Now` when generating uuids that have a time component
Allow to use something different than time.Now when generating uuids that have a time component.
This is useful for:
- Tests
- In rare cases where you want to encode a timestamp different than the current time in the id, such as an expiration date.
The package at https://github.com/gofrs/uuid seems to have this functionality, see https://pkg.go.dev/github.com/gofrs/uuid/v5#WithEpochFunc. I would love to have something similar.
If you have special requirements, please use uuidv8
Yes, please add a way to generate uuidv7 with a custom time, right now we can sort by uuidv7, but if we want to get records from database between dates, it's way too complicated right now, if we can generate a uuidv7 with a custom dates this makes it much simpler.
I will add the v8 implementation , later
hey, @it512 - v8 proposal is already up there - #178 . we're awaiting reviews from the maintainers.