Zongzi.Util.ID (zongzi v0.3.0)

Copy Markdown

A module that declares the IDs of domain entities.

Yes, it's simply identity.

Summary

Types

t()

Declare something's ID.

Identify ID of what.

Functions

Generates the ID of the new object.

Types

t()

@type t() :: binary()

Declare something's ID.

t(_any_model)

@type t(_any_model) :: t()

Identify ID of what.

Like Enumerable.t/1, it just for good looking in document.

Functions

generate_id(id_prefix)

@spec generate_id(nil | binary()) :: t()

Generates the ID of the new object.

This is a utility function used by the caller (Kernel/adapter layer); Domain's Model.new/1 does not call it automatically. Require the caller to explicitly pass in :id.