ElxValidation.In (elx_validation v0.1.0)

in:foo,bar,...

  • The field under validation must be included in the given list of values.

    not_in:foo,bar,...

  • The field under validation must not be included in the given list of values.
    data = %{
      country: "italy",
      grade: "a",
    }
    rules = [
      %{
        field: "country",
        validate: ["in:iran,italy,usa"]
      },
      %{
        field: "grade",
        validate: ["not_in:c,d,e", "in:a,b"]
      }
    ]

Link to this section Summary

Functions

target in values [a,b ...]

target not in values [a,b ...]

Link to this section Functions

Link to this function

is_in(target, values)

target in values [a,b ...]

Link to this function

is_not_in(target, values)

target not in values [a,b ...]