Max & Min - MajAhd/elx_validation Wiki

Original URL: https://github.com/MajAhd/elx_validation/wiki/Max-&-Min

max:value

data = %{
      name: "john",
      age: 20
}

rules = [
      %{
        field: "name",
        validate: ["max:10"]
      },
      %{
        field: "age",
        validate: ["max:40"]
      }
    ]

min:value

data = %{
      name: "john",
      age: 19  ---> return error minimum value is 20
}

rules = [
      %{
        field: "name",
        validate: ["min:3"]
      },
      %{
        field: "age",
        validate: ["min:20"]
      }
    ]