API reference
GD.id
Entry for generating and checking UUIDs and time-ordered ULIDs. Timestamp -1 selects the current time; other values outside the 48-bit range return an empty string. Encoded overflow is rejected.
Methods
ulid(ms: int = -1) -> Stringis_ulid(text: String) -> boolulid_time(text: String) -> int, Erruuid() -> Stringuuid_v5(space: String, name: String) -> String, Erruuid_v5_async(space: String, name: String) -> await String, Erris_uuid(text: String) -> booluuid_bytes(text: String) -> PackedByteArray, Erruuid_version(text: String) -> intnil_uuid() -> Stringdns_namespace() -> Stringurl_namespace() -> Stringoid_namespace() -> String
ulid
ulid(ms: int = -1) -> StringCreate a ULID for the specified time.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
ms | int | -1 | Timestamp or duration in milliseconds, as specified by this method. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
is_ulid
is_ulid(text: String) -> boolCheck whether text is a ULID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
ulid_time
ulid_time(text: String) -> int, ErrRead the timestamp from a ULID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
int, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
uuid
uuid() -> StringCreate a random version-4 UUID.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
uuid_v5
uuid_v5(space: String, name: String) -> String, ErrCreate a name-based version-5 UUID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
space | String | Required | UUID namespace used with the supplied name. |
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
String, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
uuid_v5_async
uuid_v5_async(space: String, name: String) -> await String, ErrDispatch UUID generation for long names to a CPU worker.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
space | String | Required | UUID namespace used with the supplied name. |
name | String | Required | Name used to register or look up the corresponding entry. |
Return value
await String, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
is_uuid
is_uuid(text: String) -> boolCheck whether text is a UUID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
bool
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
uuid_bytes
uuid_bytes(text: String) -> PackedByteArray, ErrConvert a UUID to 16 bytes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
PackedByteArray, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
uuid_version
uuid_version(text: String) -> intReturn a UUID's version.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
int
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
nil_uuid
nil_uuid() -> StringReturn the nil UUID.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
dns_namespace
dns_namespace() -> StringReturn the DNS UUID namespace.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
url_namespace
url_namespace() -> StringReturn the URL UUID namespace.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
oid_namespace
oid_namespace() -> StringReturn the OID UUID namespace.
Parameters
No parameters.
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.