ElxValidation (elx_validation v0.1.0)
Easy and Simple Data validator.
make
function for start validation
ElxValidation Github Wiki Page
install
mix.exs
{:elx_validation, "~> 0.1.0"}
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
ElxValidation.make(example_data , rules)
if it has error:
%{
errors: [
name: ["Error Message" , "Error Message"]
],
failed: true
}
Or if it hasn't error :
%{
errors: [],
failed: false
}
Link to this section Summary
Link to this section Functions
Link to this function