mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 02:47:04 +00:00
❤️ awesome and unique features for end-developers are coming...
total refactor of the hero and mvc packages, see README#Next (it's not completed yet) Former-commit-id: b85ae99cbfe5965ba919c1e15cf4989e787982c0
This commit is contained in:
@@ -3,12 +3,12 @@ package mvc
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/kataras/iris/v12/hero/di"
|
||||
"github.com/kataras/iris/v12/hero"
|
||||
)
|
||||
|
||||
var (
|
||||
baseControllerTyp = reflect.TypeOf((*BaseController)(nil)).Elem()
|
||||
errorHandlerTyp = reflect.TypeOf((*di.ErrorHandler)(nil)).Elem()
|
||||
errorHandlerTyp = reflect.TypeOf((*hero.ErrorHandler)(nil)).Elem()
|
||||
errorTyp = reflect.TypeOf((*error)(nil)).Elem()
|
||||
)
|
||||
|
||||
@@ -16,6 +16,17 @@ 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
|
||||
}
|
||||
|
||||
func isErrorHandler(ctrlTyp reflect.Type) bool {
|
||||
return ctrlTyp.Implements(errorHandlerTyp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user