StructPartial validates the fields passed in only, ignoring all others. Fields may be provided in a namespaced fashion relative to the struct provided eg. NestedStruct.Field or NestedArrayField[0].Struct.Name It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as
(s interface{}, fields ...string)
| 435 | // It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. |
| 436 | // You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. |
| 437 | func (v *Validate) StructPartial(s interface{}, fields ...string) error { |
| 438 | return v.StructPartialCtx(context.Background(), s, fields...) |
| 439 | } |
| 440 | |
| 441 | // StructPartialCtx validates the fields passed in only, ignoring all others and allows passing of contextual |
| 442 | // validation information via context.Context |