You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this utility function should return the customized uuid6.UUID instead of uuid.UUID, since the class constructor calls uuid6.uuid7(). The difference is subtle, but this way the .uuid property can return incorrect results if you try to access .uuid.time:
I ran into this while playing around with the idea of modifying the uuid6.uuid7 generator function to receive the timestamp part as a parameter, so that I could also create TypeID instances based on some historical timestamp. This'd be a really useful feature when migrating from database-generated sequenced numeric IDs to TypeIDs. Some other ID generation libraries support this.
I can open a PR for these changes if you'd like. Thanks again!
The text was updated successfully, but these errors were encountered:
Hi, and thanks for this package!
I noticed a couple of inconsistencies in the TypeID class:
this class method explicitly returns a
TypeID
, when it could usecls
, like thefrom_string
method right above it.I think this utility function should return the customized
uuid6.UUID
instead ofuuid.UUID
, since the class constructor callsuuid6.uuid7()
. The difference is subtle, but this way the.uuid
property can return incorrect results if you try to access.uuid.time
:uuid6.UUID
has an overriddentime
property, which checks theversion
, and returnssuper().time
if the version is not 6, 7, or 8.The utility function could be updated like so:
I ran into this while playing around with the idea of modifying the
uuid6.uuid7
generator function to receive the timestamp part as a parameter, so that I could also create TypeID instances based on some historical timestamp. This'd be a really useful feature when migrating from database-generated sequenced numeric IDs to TypeIDs. Some other ID generation libraries support this.I can open a PR for these changes if you'd like. Thanks again!
The text was updated successfully, but these errors were encountered: