Closed Daavidaviid closed 5 years ago
The threshold value is passed in as an int but the value being checked against is a float.
From the docs
// Min is a validation rule that checks if a value is greater or equal than the specified value.
// By calling Exclusive, the rule will check if the value is strictly greater than the specified value.
// Note that the value being checked and the threshold value must be of the same type.
// Only int, uint, float and time.Time types are supported.
// An empty value is considered valid. Please use the Required rule to make sure a value is not empty.
Try validation.Field(&u.RangeInKm, validation.Min(float64(0)), validation.Max(float64(1000))),
Thanks, I missed that part !
Shouldn't this issue be closed?
Hi, I have the following code :
I defined a structure called Users (I'm using it to query users) :
And this is the following error I get when I set
rangeInKm
which is a*float64
:I don't know why tho.