Struct validates a structs exposed fields, and automatically validates nested structs, unless otherwise specified. It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. You will need to assert the error if it's not nil eg. err.(validator.Validati
(s interface{})
| 344 | // It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. |
| 345 | // You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. |
| 346 | func (v *Validate) Struct(s interface{}) error { |
| 347 | return v.StructCtx(context.Background(), s) |
| 348 | } |
| 349 | |
| 350 | // StructCtx validates a structs exposed fields, and automatically validates nested structs, unless otherwise specified |
| 351 | // and also allows passing of context.Context for contextual validation information. |