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
DataError if the text is invalid or bytes are not exactly
16 long.
Example
Class Fields
MAX @ Uuid[get, set]The max
Uuid,ffffffff-ffff-ffff-ffff-ffffffffffff.NIL @ Uuid[get, set]The nil
Uuid,00000000-0000-0000-0000-000000000000.
Class Methods
generate() -> Uuid
Generates a random version 4 UUID.
Example
Fields
bytes @ Bin[get]The raw 16-byte binary form.
hex @ Str[get]The simple lowercase hexadecimal form without hyphens.
variant @ (:NCS: | :RFC4122: | :MICROSOFT: | :FUTURE:)[get]The UUID variant:
:NCS:,:RFC4122:,:MICROSOFT:, or:FUTURE:.version @ Int[get]The UUID version number, such as
4for a randomly generated UUID.
Methods
(eq) other -> Bool
Compares two UUID values.
Parameters
| Name | Type | Description |
|---|---|---|
other |
Value |
(lt) other -> Bool
Orders two UUID values.
Parameters
| Name | Type | Description |
|---|---|---|
other |
Uuid |
(str)() -> Str
Returns the canonical hyphenated UUID text.