Spear.Event.uuid_v4

You're seeing just the function uuid_v4, go back to Spear.Event module for more information.

Specs

uuid_v4() :: binary()

Produces a random UUID v4 in human-readable format

Examples

iex> Spear.Event.uuid_v4
"98d3a5e2-ceb4-4a78-8084-97edf9452823"
iex> Spear.Event.uuid_v4                   
"2629ea4b-d165-45c9-8a2f-92b5e20b894e"
Link to this function

uuid_v4(term)

View Source (since 0.1.0)

Produces a consistent UUID v4 in human-readable format given any input data structure

This function can be used to generate a consistent UUID for a data structure of any shape. Under the hood it uses :erlang.phash2/1 to hash the data structure, which should be portable across many environments.

This function can be taken advantage of to generate consistent event IDs for the sake of idempotency (see the Event ID section in new/3 for more information). Pass the :id option to new/3 to override the default random UUID generation.

Examples

iex> Spear.Event.uuid_v4 %{"foo" => "bar"}
"33323639-3934-4339-b332-363939343339"
iex> Spear.Event.uuid_v4 %{"foo" => "bar"}
"33323639-3934-4339-b332-363939343339"