View Source ExToolkit.Encode.Base62UUID (ExToolkit v0.9.13)

A utility module providing functions to encode and decode UUIDs using Base62 encoding.

The Base62 encoding allows representing UUIDs in a more compact form, reducing their length from 32 to 22 characters. This module supports converting standard UUIDs (as strings) to Base62 encoded UUIDs and vice-versa.

Summary

Functions

Gets @base62_uuid_length.

Decodes a Base62 encoded string into a UUID.

Encodes a UUID into a Base62 encoded string.

Gets @uuid_length.

Functions

base62_uuid_length()

Gets @base62_uuid_length.

Examples

iex> Elixir.ExToolkit.Encode.Base62UUID.base62_uuid_length()
22

decode(string)

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

Decodes a Base62 encoded string into a UUID.

This function is the inverse of encode/1. It converts a Base62 encoded string back to its original UUID form.

Examples

iex> Base62UUID.decode("2FJ5BAFmLzL78YNqBSsS9I")
{:ok, "49d3793a-2f87-4bcb-aa96-be5892848ae0"}

encode(uuid)

@spec encode(String.t()) :: String.t()

Encodes a UUID into a Base62 encoded string.

Examples

iex> Base62UUID.encode("49d3793a-2f87-4bcb-aa96-be5892848ae0")
"2FJ5BAFmLzL78YNqBSsS9I"

uuid_length()

Gets @uuid_length.

Examples

iex> Elixir.ExToolkit.Encode.Base62UUID.uuid_length()
32