@@ -176,25 +176,17 @@ func (v *Validate) RegisterAlias(alias, tags string) {
176176}
177177
178178// RegisterStructValidation registers a StructLevelFunc against a number of types.
179- // This is akin to implementing the 'Validatable' interface, but for structs for which
180- // you may not have access or rights to change.
181179//
182- // NOTES:
183- // - if this and the 'Validatable' interface are implemented the Struct Level takes precedence as to enable
184- // a struct out of your control's validation to be overridden
180+ // NOTE:
185181// - this method is not thread-safe it is intended that these all be registered prior to any validation
186182func (v * Validate ) RegisterStructValidation (fn StructLevelFunc , types ... interface {}) {
187183 v .RegisterStructValidationCtx (wrapStructLevelFunc (fn ), types ... )
188184}
189185
190186// RegisterStructValidationCtx registers a StructLevelFuncCtx against a number of types and allows passing
191187// of contextual validation information via context.Context.
192- // This is akin to implementing a 'Validatable' interface, but for structs for which
193- // you may not have access or rights to change.
194188//
195- // NOTES:
196- // - if this and the 'Validatable' interface are implemented the Struct Level takes precedence as to enable
197- // a struct out of your control's validation to be overridden
189+ // NOTE:
198190// - this method is not thread-safe it is intended that these all be registered prior to any validation
199191func (v * Validate ) RegisterStructValidationCtx (fn StructLevelFuncCtx , types ... interface {}) {
200192
@@ -494,9 +486,10 @@ func (v *Validate) StructExceptCtx(ctx context.Context, s interface{}, fields ..
494486// var i int
495487// validate.Var(i, "gt=1,lt=10")
496488//
497- // WARNING: a struct can be passed for validation eg. time.Time is a struct or if you have a custom type and have registered
498- // a custom type handler, so must allow it; however unforseen validations will occur if trying to validate a struct
499- // that is meant to be passed to 'validate.Struct'
489+ // WARNING: a struct can be passed for validation eg. time.Time is a struct or
490+ // if you have a custom type and have registered a custom type handler, so must
491+ // allow it; however unforseen validations will occur if trying to validate a
492+ // struct that is meant to be passed to 'validate.Struct'
500493//
501494// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise.
502495// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors.
@@ -511,9 +504,10 @@ func (v *Validate) Var(field interface{}, tag string) error {
511504// var i int
512505// validate.Var(i, "gt=1,lt=10")
513506//
514- // WARNING: a struct can be passed for validation eg. time.Time is a struct or if you have a custom type and have registered
515- // a custom type handler, so must allow it; however unforseen validations will occur if trying to validate a struct
516- // that is meant to be passed to 'validate.Struct'
507+ // WARNING: a struct can be passed for validation eg. time.Time is a struct or
508+ // if you have a custom type and have registered a custom type handler, so must
509+ // allow it; however unforseen validations will occur if trying to validate a
510+ // struct that is meant to be passed to 'validate.Struct'
517511//
518512// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise.
519513// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors.
@@ -562,9 +556,10 @@ func (v *Validate) VarCtx(ctx context.Context, field interface{}, tag string) (e
562556// s2 := "abcd"
563557// validate.VarWithValue(s1, s2, "eqcsfield") // returns true
564558//
565- // WARNING: a struct can be passed for validation eg. time.Time is a struct or if you have a custom type and have registered
566- // a custom type handler, so must allow it; however unforseen validations will occur if trying to validate a struct
567- // that is meant to be passed to 'validate.Struct'
559+ // WARNING: a struct can be passed for validation eg. time.Time is a struct or
560+ // if you have a custom type and have registered a custom type handler, so must
561+ // allow it; however unforseen validations will occur if trying to validate a
562+ // struct that is meant to be passed to 'validate.Struct'
568563//
569564// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise.
570565// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors.
@@ -580,9 +575,10 @@ func (v *Validate) VarWithValue(field interface{}, other interface{}, tag string
580575// s2 := "abcd"
581576// validate.VarWithValue(s1, s2, "eqcsfield") // returns true
582577//
583- // WARNING: a struct can be passed for validation eg. time.Time is a struct or if you have a custom type and have registered
584- // a custom type handler, so must allow it; however unforseen validations will occur if trying to validate a struct
585- // that is meant to be passed to 'validate.Struct'
578+ // WARNING: a struct can be passed for validation eg. time.Time is a struct or
579+ // if you have a custom type and have registered a custom type handler, so must
580+ // allow it; however unforseen validations will occur if trying to validate a
581+ // struct that is meant to be passed to 'validate.Struct'
586582//
587583// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise.
588584// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors.
0 commit comments