ElxValidation.Min (elx_validation v0.1.0)

min:value

  • The field under validation must have a minimum value. Strings and numerics are evaluated in the same fashion as the size rule.
    data = %{
      name: "john",
      age: 19  ---> return error minimum value is 20
    }
    rules = [
      %{
        field: "name",
        validate: ["min:3"]
      },
      %{
        field: "age",
        validate: ["min:20"]
      }
    ]

Link to this section Summary

Functions

check value min size

Link to this section Functions

Link to this function

is_minimum(target, value)

check value min size

  • min : 3 / value 4 -> passed
  • min : 3 / value "hello" -> failed (hello is 5 char > 3)
  • value is string and convert to number