View Source Appwrite.Utils.Id (appwrite v0.1.9)
Helper module to generate ID strings for resources. This module provides functions to generate unique ID strings, either based on a timestamp or with custom or Appwrite-like generation methods.
Summary
Functions
Returns the provided custom ID.
Generates a unique ID by combining a hex timestamp and a random hex padding.
Functions
Returns the provided custom ID.
Examples
iex> ID.custom("custom_id")
"custom_id"
@spec unique(non_neg_integer()) :: String.t()
Generates a unique ID by combining a hex timestamp and a random hex padding.
The padding defaults to 7 hex digits but can be modified.
Examples
iex> ID.unique()
"1a3b5f9cdb013f703"
iex> ID.unique(10)
"1a3b5f9cdb013f703f70388"