Var validates a single variable using tag style validation. eg. var i int validate.Var(i, "gt=1,lt=10") WARNING: a struct can be passed for validation eg. time.Time is a struct or if you have a custom type and have registered a custom type handler, so must allow it; however unforeseen validations w
(field interface{}, tag string)
| 592 | // You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. |
| 593 | // validate Array, Slice and maps fields which may contain more than one error |
| 594 | func (v *Validate) Var(field interface{}, tag string) error { |
| 595 | return v.VarCtx(context.Background(), field, tag) |
| 596 | } |
| 597 | |
| 598 | // VarCtx validates a single variable using tag style validation and allows passing of contextual |
| 599 | // validation information via context.Context. |