protocol

# `ulid_protocol`

Universally Unique Lexicographically Sortable Identifier (ULID) generator protocol.

Availability:
`logtalk_load(ulid(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2023-05-17
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `generate/1`

Generates a new ULID.

Compilation flags:
`static`
Template:
`generate(ULID)`
Mode and number of proofs:
`generate(--ulid)` - `one`

### `generate/2`

Generates a new ULID from a timestamp (number of milliseconds since the Unix epoch: 00:00:00 UTC on January 1, 1970).

Compilation flags:
`static`
Template:
`generate(Milliseconds,ULID)`
Mode and number of proofs:
`generate(+integer,--ulid)` - `one`

### `generate/8`

Generates a new ULID from a timestamp discrete components.

Compilation flags:
`static`
Template:
`generate(Year,Month,Day,Hours,Minutes,Seconds,Milliseconds,ULID)`
Mode and number of proofs:
`generate(+integer,+integer,+integer,+integer,+integer,+integer,+integer,--ulid)` - `one`

### `timestamp/2`

Returns the given ULID timestamp (number of milliseconds since the Unix epoch: 00:00:00 UTC on January 1, 1970).

Compilation flags:
`static`
Template:
`timestamp(ULID,Milliseconds)`
Mode and number of proofs:
`timestamp(++ulid,-integer)` - `one`

### `timestamp/8`

Decodes a ULID into its timestamp discrete components.

Compilation flags:
`static`
Template:
`timestamp(ULID,Year,Month,Day,Hours,Minutes,Seconds,Milliseconds)`
Mode and number of proofs:
`timestamp(++ulid,-integer,-integer,-integer,-integer,-integer,-integer,-integer)` - `one`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)