View Source Base62UUID (Base62UUID v3.0.0)

A base 62-encoded v4 UUID.

Link to this section Summary

Functions

Decode a an encoded UUID.

Decode a an encoded UUID.

Encode a v4 UUID to a 22-byte encoded UUID.

Encode a v4 UUID to a 22-byte encoded UUID, and raise on an error.

Generate a 22-byte base-62-encoded v4 UUID.

Link to this section Functions

Specs

decode(String.t()) :: {:ok, String.t()} | {:error, String.t()}

Decode a an encoded UUID.

Returns an error tuple if the UUID is invalid.

Example

iex> Base62UUID.decode("0BllEZppLhVt2a9PljPUJ2")
{:ok, "063cd93e-dd59-43b6-928b-2d00a49087fc"}

Specs

decode!(String.t()) :: String.t()

Decode a an encoded UUID.

Example

iex> Base62UUID.decode!("0BllEZppLhVt2a9PljPUJ2")
"063cd93e-dd59-43b6-928b-2d00a49087fc"

Specs

encode(String.t()) :: {:ok, String.t()} | {:error, String.t()}

Encode a v4 UUID to a 22-byte encoded UUID.

Returns an error message if the UUID was invalid.

Example

iex> Base62UUID.encode("063cd93e-dd59-43b6-928b-2d00a49087fc")
{:ok, "0BllEZppLhVt2a9PljPUJ2"}

Specs

encode!(String.t()) :: String.t()

Encode a v4 UUID to a 22-byte encoded UUID, and raise on an error.

Example

iex> Base62UUID.encode!("063cd93e-dd59-43b6-928b-2d00a49087fc")
"0BllEZppLhVt2a9PljPUJ2"

Specs

generate() :: String.t()

Generate a 22-byte base-62-encoded v4 UUID.