View Source OnePiece.Commanded.ValueObject (OnePiece.Commanded v0.15.1)
Defines "Value Object" modules.
Link to this section Summary
Functions
Converts the module into an Ecto.Schema
.
Link to this section Functions
@spec __using__(opts :: []) :: any()
Converts the module into an Ecto.Schema
.
It derives from Jason.Encoder
and also adds some factory functions to create
structs.
usage
Usage
defmodule MyValueObject do
use OnePiece.Commanded.ValueObject
embedded_schema do
field :title, :string
# ...
end
end
{:ok, my_value} = MyValueObject.new(%{title: "Hello, World!"})