Funx.Predicate.NotEq (funx v0.8.4)

View Source

Predicate that checks if a value does not equal an expected value using an Eq comparator.

Options

  • :value (required) The value to compare against.

  • :eq (optional) An equality comparator. Defaults to Funx.Eq.Protocol.

Examples

use Funx.Predicate

# Check that status is not deleted
pred do
  check :status, {NotEq, value: :deleted}
end

# Check that struct is not a specific error type
pred do
  check :error, {NotEq, value: FatalError}
end

# With custom Eq comparator
pred do
  check :amount, {NotEq, value: zero, eq: Money.Eq}
end