uuid7
Generates a UUID v7 string (RFC 9562). UUID v7 embeds a Unix timestamp in milliseconds, making it chronologically sortable while retaining randomness.
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Returns
Section titled “Returns”string — A UUID v7 string in the format xxxxxxxx-xxxx-7xxx-yxxx-xxxxxxxxxxxx
Examples
Section titled “Examples”Generate a UUID v7
Section titled “Generate a UUID v7”Produces a RFC 9562 UUID v7 string with an embedded millisecond timestamp.
UUIDs are chronologically sortable
Section titled “UUIDs are chronologically sortable”UUID v7 values generated later are lexicographically greater, making them ideal for database primary keys.
Each UUID is unique
Section titled “Each UUID is unique”No two calls produce the same value.
