12345678910111213141516171819202122 |
- package mvc
- import (
- "reflect"
- )
- var baseControllerTyp = reflect.TypeOf((*BaseController)(nil)).Elem()
- func isBaseController(ctrlTyp reflect.Type) bool {
- return ctrlTyp.Implements(baseControllerTyp)
- }
- // indirectType returns the value of a pointer-type "typ".
- // If "typ" is a pointer, array, chan, map or slice it returns its Elem,
- // otherwise returns the typ as it's.
- func indirectType(typ reflect.Type) reflect.Type {
- switch typ.Kind() {
- case reflect.Ptr, reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- return typ.Elem()
- }
- return typ
- }
|