OnePiece.Commanded.Entity (OnePiece.Commanded v0.4.1) View Source

Defines a module as an "Entity" in the context of Domain-Driven Design.

Link to this section Summary

Types

The identity of an entity.

Functions

Converts the module into an Ecto.Schema, and derive from Jason.Encoder.

Link to this section Types

Specs

identity() :: String.t()

The identity of an entity.

Link to this section Functions

Link to this macro

__using__(opts \\ [])

View Source (macro)

Specs

__using__(opts :: [{:identifier, atom()}]) :: any()

Converts the module into an Ecto.Schema, and derive from Jason.Encoder.

Usage

defmodule MyEntity do
  use OnePiece.Commanded.Entity, identifier: :id

  embedded_schema do
    # ...
  end
end