mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 06:42:10 +08:00
opt switch branchs in ValidateStruct()
This commit is contained in:
parent
03ce1a6b86
commit
023a72b783
@ -40,12 +40,9 @@ func (v *defaultValidator) ValidateStruct(obj interface{}) error {
|
||||
}
|
||||
|
||||
value := reflect.ValueOf(obj)
|
||||
valueType := value.Kind()
|
||||
if valueType == reflect.Ptr {
|
||||
switch value.Kind() {
|
||||
case reflect.Ptr:
|
||||
return v.ValidateStruct(value.Elem().Interface())
|
||||
}
|
||||
|
||||
switch valueType {
|
||||
case reflect.Struct:
|
||||
return v.validateStruct(obj)
|
||||
case reflect.Slice, reflect.Array:
|
||||
|
Loading…
x
Reference in New Issue
Block a user