Packages

Use CommandedUniquenessMiddleware to ensure short-term value uniqueness, usually during Commanded command dispatch.

Current section

Files

Jump to
commanded_uniqueness_middleware test support test_command_partition2.ex
Raw

test/support/test_command_partition2.ex

defmodule TestCommandPartition2 do
defstruct [
:id,
:name
]
end
defimpl Commanded.Middleware.Uniqueness.UniqueFields, for: TestCommandPartition2 do
def unique(%TestCommandPartition2{id: id}),
do: [
{:name, "has already been taken", id, partition: "SomeCommonPartition"}
]
end