View Source ShortUUID.Behaviour behaviour (ShortUUID v4.1.0)
Defines the behavior for ShortUUID-compatible modules.
This behavior ensures consistent interface across different ShortUUID implementations. Any module implementing this behavior should provide encode/decode functionality for converting UUIDs to shorter string representations and back.
Required Callbacks
encode/1- Encodes a standard UUID into a shorter stringencode!/1- Encodes a UUID, raising an exception on invalid inputdecode/1- Decodes a shortened UUID string back into standard UUID formatdecode!/1- Decodes a shortened UUID, raising an exception on invalid input
Summary
Callbacks
Decodes a shortened UUID string back into standard UUID format.
Decodes a shortened UUID string back into standard UUID format. Raises an ArgumentError if the input is invalid.
Encodes a UUID string into a shorter string representation.
Encodes a UUID string into a shorter string representation. Raises an ArgumentError if the input is invalid.
Callbacks
Decodes a shortened UUID string back into standard UUID format.
Parameters
string- A shortened UUID string
Returns
{:ok, uuid}- Successfully decoded UUID{:error, message}- Error with descriptive message
Decodes a shortened UUID string back into standard UUID format. Raises an ArgumentError if the input is invalid.
Parameters
string- A shortened UUID string
Returns
uuid- Successfully decoded UUID
Raises
ArgumentError- If the input is invalid
Encodes a UUID string into a shorter string representation.
Parameters
uuid- A standard UUID string (with or without hyphens)
Returns
{:ok, encoded}- Successfully encoded string{:error, message}- Error with descriptive message
Encodes a UUID string into a shorter string representation. Raises an ArgumentError if the input is invalid.
Parameters
uuid- A standard UUID string (with or without hyphens)
Returns
encoded- Successfully encoded string
Raises
ArgumentError- If the input is invalid