Base62UUID v2.0.1 Base62UUID View Source

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, and raise on an error

Encode a v4 UUID to a 22-byte encoded UUID

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

Link to this section Functions

Decode a an encoded UUID.

Example

iex> Base62UUID.decode!("0BllEZppLhVt2a9PljPUJ2")
"063cd93e-dd59-43b6-928b-2d00a49087fc"
Link to this function decode(uuid) View Source
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"}

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"
Link to this function encode(uuid) View Source
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"}

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