.. index:: ulid_protocol
.. _ulid_protocol/0:

.. rst-class:: right

**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)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: generate/1
.. _ulid_protocol/0::generate/1:

``generate/1``
^^^^^^^^^^^^^^

Generates a new ULID.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``generate(ULID)``
| **Mode and number of proofs:**
|    ``generate(--ulid)`` - ``one``


------------

.. index:: generate/2
.. _ulid_protocol/0::generate/2:

``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``


------------

.. index:: generate/8
.. _ulid_protocol/0::generate/8:

``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``


------------

.. index:: timestamp/2
.. _ulid_protocol/0::timestamp/2:

``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``


------------

.. index:: timestamp/8
.. _ulid_protocol/0::timestamp/8:

``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)

