MCPcopy
hub / github.com/go-playground/validator / Struct

Method Struct

validator_instance.go:346–348  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

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.
346func (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.

Calls 1

StructCtxMethod · 0.95