Encode and decode Gaiia Global IDs.
Global IDs combine a snake_cased type name with a Base58-encoded UUID,
separated by an underscore: account_8rnXNuR5sKP5uNwoPL41Zp.
Summary
Functions
Decodes a Global ID into a tuple of {type, uuid}.
Encodes a type name and UUID into a Global ID.
Converts a type name and UUID to a Global ID. Alias for encode/2.
Decodes a short UUID back to a standard UUID string.
Encodes a UUID to a 22-character Base58 short UUID.
Extracts the UUID from a Global ID.
Extracts the type name from a Global ID.
Functions
Decodes a Global ID into a tuple of {type, uuid}.
Examples
iex> Gaiia.GlobalID.decode("account_8rnXNuR5sKP5uNwoPL41Zp")
{"account", "3c3b1978-6a68-4a13-bdc2-2d51c8ef7519"}
Encodes a type name and UUID into a Global ID.
Examples
iex> Gaiia.GlobalID.encode("Account", "3c3b1978-6a68-4a13-bdc2-2d51c8ef7519")
"account_8rnXNuR5sKP5uNwoPL41Zp"
Converts a type name and UUID to a Global ID. Alias for encode/2.
Examples
iex> Gaiia.GlobalID.from_uuid("Account", "3c3b1978-6a68-4a13-bdc2-2d51c8ef7519")
"account_8rnXNuR5sKP5uNwoPL41Zp"
Decodes a short UUID back to a standard UUID string.
Examples
iex> Gaiia.GlobalID.short_to_uuid("8rnXNuR5sKP5uNwoPL41Zp")
"3c3b1978-6a68-4a13-bdc2-2d51c8ef7519"
Encodes a UUID to a 22-character Base58 short UUID.
Examples
iex> Gaiia.GlobalID.short_uuid("3c3b1978-6a68-4a13-bdc2-2d51c8ef7519")
"8rnXNuR5sKP5uNwoPL41Zp"
Extracts the UUID from a Global ID.
Examples
iex> Gaiia.GlobalID.to_uuid("account_8rnXNuR5sKP5uNwoPL41Zp")
"3c3b1978-6a68-4a13-bdc2-2d51c8ef7519"
Extracts the type name from a Global ID.
Examples
iex> Gaiia.GlobalID.type("account_8rnXNuR5sKP5uNwoPL41Zp")
"account"