mirror of
https://github.com/kataras/iris.git
synced 2025-02-09 02:34:55 +01:00
23 lines
562 B
Go
23 lines
562 B
Go
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
|
|
}
|