View Source OnePiece.Commanded.ValueObject (OnePiece.Commanded v0.19.1)

Defines "Value Object" modules.

Summary

Functions

Converts the module into an Ecto.Schema and add factory functions to create structs.

Functions

Link to this macro

__using__(opts \\ [])

View Source (macro)
@spec __using__(opts :: []) :: any()

Converts the module into an Ecto.Schema and add factory functions to create structs.

Using

Derives

Usage

defmodule MyValueObject do
  use OnePiece.Commanded.ValueObject

  embedded_schema do
    field :title, :string
    # ...
  end
end

{:ok, my_value} = MyValueObject.new(%{title: "Hello, World!"})