Cqrs.CommandValidation (cqrs_tools v0.1.1) View Source

Defines validation functions for a validated command.

Link to this section Summary

Functions

Adds a validation_function to the list of validations to run.

Creates a new Cqrs.CommandValidation struct.

Runs the list of 'validation_function' functions

Link to this section Types

Specs

command() :: map()

Specs

t() :: %Cqrs.CommandValidation{command: command(), validations: list()}

Specs

validation_function() ::
  (command() -> any() | {:error, any()})
  | (command(), keyword() -> any() | {:error, any()})

Link to this section Functions

Specs

add(t(), validation_function()) :: t()

Adds a validation_function to the list of validations to run.

Specs

new(command()) :: t()

Creates a new Cqrs.CommandValidation struct.

Link to this function

run(validation, opts \\ [])

View Source

Specs

run(t(), keyword()) :: {:ok, command()} | {:error, list()}

Runs the list of 'validation_function' functions