Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 722 Bytes

min.md

File metadata and controls

30 lines (22 loc) · 722 Bytes

Min Checker

The min checker checks if the given int or float value is greather than the given minimum. If the value is below the minimum, the checker will return the NOT_MIN result. Here is an example:

type User struct {
  Age int `checkers:"min:21"`
}

user := &User{
  Age: 45,
}

mistakes, valid := checker.Check(user)
if !valid {
  // Send the mistakes back to the user
}

In your custom checkers, you can call the min checker function IsMin to validate the user input. Here is an example:

age := 45

result := checker.IsMin(age, 21)

if result != checker.ResultValid {
  // Send the mistakes back to the user
}