sm.uuid

A universally unique identifier (UUID) is a 128-bit number that can guarantee uniqueness across space and time.

To generate one, use sm.uuid.new.

Functions

generateNamed

sm.uuid.generateNamed( namespace, name )

Generates a named (version 5) uuid.

Parameters:

Name Type Description
namespace Uuid A uuid namespace for the name. The namespace makes sure any equal name from different namespaces do not collide.
name string A name, to generate a uuid from. Provided the same namespace and name, the uuid will be the same.

Returns:

Type Description
Uuid The created uuid.

generateRandom

sm.uuid.generateRandom(  )

Generates a random (version 4) uuid.

Returns:

Type Description
Uuid The generated uuid.

getNil

sm.uuid.getNil(  )

Creates a nil uuid {00000000-0000-0000-0000-000000000000}

Returns:

Type Description
Uuid The nil uuid.

new - Uuid

sm.uuid.new( uuid )

Creates a uuid from a string or generates a random uuid (version 4).

Parameters:

Name Type Description
uuid (optional) Uuid The uuid to create a uuid instance from. If none is provided, generate a random uuid.

Returns:

Type Description
Uuid The created uuid.

new - string

sm.uuid.new( uuid )

Creates a uuid from a string or generates a random uuid (version 4).

Parameters:

Name Type Description
uuid (optional) string The uuid string to create a uuid instance from. If none is provided, generate a random uuid.

Returns:

Type Description
Uuid The created uuid.