ElxValidation (elx_validation v0.1.3)

Elx Validation


install

mix.exs
   {:elx_validation, "~> 0.1.3"}
mix deps.get

How To use

example_data = %{
  first_name: "Majid"
}
rules = [
   %{
      field: "first_name",
      as: "first name",
      validate: ["required", "string", "max:128"].
    },
]

field : The Field name that need to validate

as : its optional and use for response error

validate : list of rules and validations

Run Validation : ElxValidation.make(example_data , rules)

Validator has Error

%{
    errors: [
       name: ["Error Message" , "Error Message"]
    ],
    failed: true
}

Validator without Error:

%{
   errors: [],
   failed: false
}

Link to this section Summary

Link to this section Functions

Link to this function

make(data, rules)