Funx.Predicate.Eq (funx v0.8.4)

View Source

Predicate that checks if a value equals an expected value using an Eq comparator.

Options

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

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

Examples

use Funx.Predicate

# Check for specific value
pred do
  check [:status], {Eq, value: :active}
end

# Check for struct type
pred do
  check [:error], {Eq, value: CustomError}
end

# With custom Eq comparator
pred do
  check [:amount], {Eq, value: expected, eq: Money.Eq}
end