Funx.Predicate.NotIn (funx v0.8.4)

View Source

Predicate that checks if a value is not a member of a given collection using an Eq comparator.

Options

  • :values (required) The list of disallowed values.

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

Examples

use Funx.Predicate

# Check if status is not one of disallowed values
pred do
  check :status, {NotIn, values: [:deleted, :archived]}
end

# Check if struct type is not in list
pred do
  check :event, {NotIn, values: [DeprecatedEvent, LegacyEvent]}
end

# With custom Eq comparator
pred do
  check :item, {NotIn, values: blocked_items, eq: Item.Eq}
end