mirror of
https://github.com/kataras/iris.git
synced 2025-12-24 05:17:03 +00:00
Former-commit-id: 2b48b9b912e9eb8f5f2c6d413907dbfdae857e08
This commit is contained in:
@@ -73,6 +73,7 @@ func IndirectValue(v reflect.Value) reflect.Value {
|
||||
if k := v.Kind(); k == reflect.Ptr { //|| k == reflect.Interface {
|
||||
return v.Elem()
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
@@ -106,6 +107,17 @@ func IndirectType(typ reflect.Type) reflect.Type {
|
||||
return typ
|
||||
}
|
||||
|
||||
// IsNil same as `reflect.IsNil` but a bit safer to use, returns false if not a correct type.
|
||||
func IsNil(v reflect.Value) bool {
|
||||
k := v.Kind()
|
||||
switch k {
|
||||
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
|
||||
return v.IsNil()
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func goodVal(v reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice:
|
||||
|
||||
Reference in New Issue
Block a user