Codebase list golang-github-go-playground-validator-v10 / cf7eb8f
Merge pull request #443 from kszafran/patch-1 Fix typos Dean Karn authored 5 years ago GitHub committed 5 years ago
1 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
88 type StructLevelFunc func(sl StructLevel)
99
1010 // StructLevelFuncCtx accepts all values needed for struct level validation
11 // but also allows passing of contextual validation information vi context.Context.
11 // but also allows passing of contextual validation information via context.Context.
1212 type StructLevelFuncCtx func(ctx context.Context, sl StructLevel)
1313
14 // wrapStructLevelFunc wraps noramal StructLevelFunc makes it compatible with StructLevelFuncCtx
14 // wrapStructLevelFunc wraps normal StructLevelFunc makes it compatible with StructLevelFuncCtx
1515 func wrapStructLevelFunc(fn StructLevelFunc) StructLevelFuncCtx {
1616 return func(ctx context.Context, sl StructLevel) {
1717 fn(sl)
2222 // to validate a struct
2323 type StructLevel interface {
2424
25 // returns the main validation object, in case one want to call validations internally.
26 // this is so you don;t have to use anonymous functoins to get access to the validate
25 // returns the main validation object, in case one wants to call validations internally.
26 // this is so you don't have to use anonymous functions to get access to the validate
2727 // instance.
2828 Validator() *Validate
2929
3838
3939 // ExtractType gets the actual underlying type of field value.
4040 // It will dive into pointers, customTypes and return you the
41 // underlying value and it's kind.
41 // underlying value and its kind.
4242 ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool)
4343
4444 // reports an error just by passing the field and tag information
4646 // NOTES:
4747 //
4848 // fieldName and altName get appended to the existing namespace that
49 // validator is on. eg. pass 'FirstName' or 'Names[0]' depending
49 // validator is on. e.g. pass 'FirstName' or 'Names[0]' depending
5050 // on the nesting
5151 //
5252 // tag can be an existing validation tag or just something you make up
5959 //
6060 // relativeNamespace and relativeActualNamespace get appended to the
6161 // existing namespace that validator is on.
62 // eg. pass 'User.FirstName' or 'Users[0].FirstName' depending
62 // e.g. pass 'User.FirstName' or 'Users[0].FirstName' depending
6363 // on the nesting. most of the time they will be blank, unless you validate
6464 // at a level lower the the current field depth
6565 ReportValidationErrors(relativeNamespace, relativeActualNamespace string, errs ValidationErrors)