Uuid
Parsed or generated UUID value.
Constructor
Uuid value
Parses UUID text or binary, or copies an existing Uuid.
Text may be hyphenated, simple, braced, or URN form. Binary values must be exactly 16 bytes.
Parameters
| Name | Type | Description |
|---|---|---|
value |
(Str | Bin | Uuid) |
UUID to parse or copy. |
Errors
ValueError if the text is invalid or bytes are not exactly 16 long.
Example
Class Fields
MAXThe max
Uuid,ffffffff-ffff-ffff-ffff-ffffffffffff.NILThe nil
Uuid,00000000-0000-0000-0000-000000000000.
Class Methods
generate() -> Uuid
Generates a random version 4 UUID.
Example
Fields
bytesThe raw 16-byte binary form.
hexThe simple lowercase hexadecimal form without hyphens.
variantThe UUID variant:
:NCS:,:RFC4122:,:MICROSOFT:, or:FUTURE:.versionThe UUID version number, such as
4for a randomly generated UUID.
Methods
(eq) other
Compares two UUID values.
(str)()
Returns the canonical hyphenated UUID text.