ing
This commit is contained in:
parent
6cdd0515a5
commit
e4e7e10e58
23
reflect/type.go
Normal file
23
reflect/type.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package reflect
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func IsTypeKind(t reflect.Type, kind reflect.Kind, removePtr bool) bool {
|
||||
if reflect.Ptr == t.Kind() {
|
||||
if removePtr {
|
||||
return IsTypeKind(t.Elem(), kind, removePtr)
|
||||
}
|
||||
}
|
||||
|
||||
return kind == t.Kind()
|
||||
}
|
||||
|
||||
func GetTypeInfo(t reflect.Type) (realType reflect.Type, pkgName string, name string) {
|
||||
if reflect.Ptr == t.Kind() {
|
||||
return GetTypeInfo(t.Elem())
|
||||
}
|
||||
|
||||
return t, t.PkgPath(), t.Name()
|
||||
}
|
Loading…
Reference in New Issue
Block a user