2017-11-23 11:43:29 +01:00
|
|
|
package mvc2
|
|
|
|
|
2017-12-10 06:00:51 +01:00
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
|
|
|
|
"github.com/kataras/iris/context"
|
|
|
|
)
|
|
|
|
|
2017-12-13 05:17:28 +01:00
|
|
|
var baseControllerTyp = reflect.TypeOf((*BaseController)(nil)).Elem()
|
|
|
|
|
|
|
|
func isBaseController(ctrlTyp reflect.Type) bool {
|
|
|
|
return ctrlTyp.Implements(baseControllerTyp)
|
|
|
|
}
|
|
|
|
|
|
|
|
var contextTyp = reflect.TypeOf((*context.Context)(nil)).Elem()
|
2017-11-23 11:43:29 +01:00
|
|
|
|
|
|
|
func isContext(inTyp reflect.Type) bool {
|
2017-12-13 05:17:28 +01:00
|
|
|
return inTyp.Implements(contextTyp)
|
2017-11-23 11:43:29 +01:00
|
|
|
}
|
|
|
|
|
2017-12-10 06:00:51 +01:00
|
|
|
func getInputArgsFromFunc(funcTyp reflect.Type) []reflect.Type {
|
|
|
|
n := funcTyp.NumIn()
|
|
|
|
funcIn := make([]reflect.Type, n, n)
|
|
|
|
for i := 0; i < n; i++ {
|
|
|
|
funcIn[i] = funcTyp.In(i)
|
|
|
|
}
|
|
|
|
return funcIn
|
|
|
|
}
|