ValidateStruct() — gin Function Reference
Architecture documentation for the ValidateStruct() function in default_validator.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 9b7c551c_bce5_10be_3f2b_4d2e5c7d2226["ValidateStruct()"] 63173ece_518f_a541_dcd2_90ab04f7fba0["validateStruct()"] 9b7c551c_bce5_10be_3f2b_4d2e5c7d2226 -->|calls| 63173ece_518f_a541_dcd2_90ab04f7fba0 style 9b7c551c_bce5_10be_3f2b_4d2e5c7d2226 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binding/default_validator.go lines 44–73
func (v *defaultValidator) ValidateStruct(obj any) error {
if obj == nil {
return nil
}
value := reflect.ValueOf(obj)
switch value.Kind() {
case reflect.Ptr:
if value.Elem().Kind() != reflect.Struct {
return v.ValidateStruct(value.Elem().Interface())
}
return v.validateStruct(obj)
case reflect.Struct:
return v.validateStruct(obj)
case reflect.Slice, reflect.Array:
count := value.Len()
validateRet := make(SliceValidationError, 0)
for i := range count {
if err := v.ValidateStruct(value.Index(i).Interface()); err != nil {
validateRet = append(validateRet, err)
}
}
if len(validateRet) == 0 {
return nil
}
return validateRet
default:
return nil
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does ValidateStruct() do?
ValidateStruct() is a function in the gin codebase.
What does ValidateStruct() call?
ValidateStruct() calls 1 function(s): validateStruct.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free