ballerina/uuid

Overview

This module provides APIs to generate and inspect UUIDs (Universally Unique Identifiers).

The UUIDs are generated based on the RFC 4122 standard. This module supports generating 4 versions of UUIDs.

Version 1

Generated using the MAC address of the computer and the time of generation.

Version 3

Cryptographic hashing and application-provided text strings are used to generate a UUID. MD5 hashing is used.

Version 4

Uses a pseudo-random number generator to generate the UUID. Every bit of the string is randomly generated.

Version 5

Similar to Version 3 but uses SHA-1 instead of MD5.

Other operations include validating a given UUID string and getting the version of a UUID string.

For information on the operations, which you can perform with the uuid module, see the below Functions.

Functions

[15]

createType1AsRecord

Returns a UUID of type 1 as a UUID record.

createType1AsString

Returns a UUID of type 1 as a string.

createType3AsRecord

Returns a UUID of type 3 as a UUID record.

createType3AsString

Returns a UUID of type 3 as a string.

createType4AsRecord

Returns a UUID of type 4 as a UUID record.

createType4AsString

Returns a UUID of type 4 as a string.

createType5AsRecord

Returns a UUID of type 5 as a UUID record.

createType5AsString

Returns a UUID of type 5 as a string.

getVersion

Detect RFC version of a UUID.

nilAsRecord

Returns a nil UUID as a UUID record.

nilAsString

Returns a nil UUID as a string.

toBytes

Converts to an array of bytes.

toRecord

Converts to a UUID record.

toString

Converts to a UUID string.

validate

Test a string to see if it is a valid UUID.

Records

[1]

Uuid

Represents a UUID.

Enums

[2]

NamespaceUUID

Represents UUIDs strings of well known namespace IDs.

Version

Represents the UUID versions.

Errors

[1]

Error

Represents UUID module related errors.