UUID functions

UUID functions allow you to construct UUID values, and fetch their most/least significant bits.

uuid()

Details

Syntax

uuid()

Description

Returns a randomly generated UUID.

Arguments

Name

Type

Description

Returns

UUID

Details

Syntax

uuid(name :: STRING)

Description

Converts a STRING value to a UUID.

Arguments

Name

Type

Description

name

STRING

The STRING must be 32 hexadecimal digits displayed in 5 groups, separated by 4 hyphens.

Returns

UUID

Details

Syntax

uuid(mostSigBits :: INTEGER, leastSigBits :: INTEGER)

Description

Converts two INTEGER values to a UUID.

Arguments

Name

Type

Description

mostSigBits

INTEGER

The most significant bits.

leastSigBits

INTEGER

The least significant bits.

Returns

UUID

Considerations

The randomly generated UUID value is not intended for cryptographic use.

UUID values can be stored as properties.

A null name, mostSigBits, or leastSigBits value will return null.

Example 1. Construct a random UUID value
Query
RETURN uuid() AS randomUUID
Result
randomUUID

UUID("550e8400-e29b-41d4-a716-446655440000")

Rows: 1

Example 2. Convert a STRING value to a UUID
Query
RETURN uuid("550e8400-e29b-41d4-a716-446655440000") AS uuid
Result
uuid

uuid("550e8400-e29b-41d4-a716-446655440000")

Rows: 1

Example 3. Convert two INTEGER values to a UUID
Query
RETURN uuid(42, 42) AS uuid
Result
uuid

uuid("00000000-0000-002a-0000-00000000002a")

Rows: 1

Example 4. null values
Query
RETURN uuid(null) AS nullUUIDValue,
       uuid(42, null) AS nullMostSigBits,
       uuid(null, 42) AS nullLeastSigBits,
       uuid(null, null) AS nullMostLeastSigBits
Result
nullUUIDValue nullMostSigBits nullLeastSigBits nullMostLeastSigBits

null

null

null

null

Rows: 1

uuid.leastSignificantBits()

Details

Syntax

uuid.leastSignificantBits(uuid)

Description

Returns the least significant bits from the given UUID.

Arguments

Name

Type

Description

uuid

UUID

The UUID to return the least significant bits from.

Returns

INTEGER

Considerations

uuid.leastSignificantBits(null) returns null.

The least significant bits represents the lower 64 bits of a UUID value (the least significant half).

Query
WITH uuid("550e8400-e29b-41d4-a716-446655440000") AS uuid
RETURN uuid.leastSignificantBits(uuid) AS leastSignificantBits
Result
leastSignificantBits

-6406858213580079104

Rows: 1

uuid.mostSignificantBits()

Details

Syntax

uuid.mostSignificantBits(uuid)

Description

Returns the most significant bits from the given UUID.

Arguments

Name

Type

Description

uuid

UUID

The UUID to return the most significant bits from.

Returns

INTEGER

Considerations

uuid.mostSignificantBits(null) returns null.

The most significant bits represents the upper 64 bits of a UUID value (the most significant half).

Query
WITH uuid("550e8400-e29b-41d4-a716-446655440000") AS uuid
RETURN uuid.mostSignificantBits(uuid) AS mostSignificantBits
Result
mostSignificantBits

6128981282234515924

Rows: 1