The ULID text form of 128 bits: 26 characters of Crockford base32
(0-9, A-Z minus I, L, O, U), most significant bits first, so
the first 48 bits (a Unix millisecond timestamp) make the string sort by
time.
Only the canonical, uppercase form is accepted. The ULID spec lets a
decoder fold case and read I/L as 1 and O as 0; this module
doesn't, so every id has exactly one spelling in a URN, a URL path, and a
storage key.
Summary
Functions
@spec decode(term()) :: {:ok, <<_::128>>} | :error
Decode a canonical ULID to its 128 bits. :error for anything else,
including a timestamp past what DateTime can represent; never raises on
untrusted input.
@spec encode(<<_::128>>) :: String.t()
Encode 128 bits as a canonical ULID.
@spec timestamp_ms(<<_::128>>) :: non_neg_integer()
The 48-bit Unix millisecond timestamp of 128 ULID bits.