Commanded.Middleware.Uniqueness.UniqueFields protocol (Commanded Uniqueness Middleware v0.6.4) View Source
Link to this section Summary
Functions
Returns unique fields for a command as a list of tuples as:
{field_name :: atom() | list(atom), error_message :: String.t(), owner :: term, opts :: keyword()},
where opts might contain none, one or multiple options:
ignore_case: true or ignore_case: [:email, :username] for multi-fields entities - binary-based
fields are downcased before comparison
:label - use this atom as error label
:is_unique - (term, String.t(), term, keyword() -> boolean())
:partition - use to set custom partition name
:no_owner - if true then ignore owner and check field_name - field_value pair uniqueness
in a partition scope. release_by_value/3 must be used to release key-value pair in such case.
Link to this section Types
Specs
t() :: term()
Link to this section Functions
Returns unique fields for a command as a list of tuples as:
{field_name :: atom() | list(atom), error_message :: String.t(), owner :: term, opts :: keyword()},
where opts might contain none, one or multiple options:
ignore_case: true or ignore_case: [:email, :username] for multi-fields entities - binary-based
fields are downcased before comparison
:label - use this atom as error label
:is_unique - (term, String.t(), term, keyword() -> boolean())
:partition - use to set custom partition name
:no_owner - if true then ignore owner and check field_name - field_value pair uniqueness
in a partition scope. release_by_value/3 must be used to release key-value pair in such case.
:no_owner option has sense when it is necessary to ensure uniquenesses in embedded structs.