1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-28 06:15:59 +00:00

Update to version 12.1.8 - Read HISTORY.md

Former-commit-id: d3d30cb15537146e3071731be9d674a5cb59de97
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-16 11:14:35 +02:00
parent 899aec8b19
commit 08403f0317
21 changed files with 275 additions and 240 deletions

View File

@@ -2,6 +2,8 @@ package di
import (
"reflect"
"github.com/kataras/iris/v12/context"
)
// EmptyIn is just an empty slice of reflect.Value.
@@ -131,6 +133,19 @@ func goodVal(v reflect.Value) bool {
return v.IsValid()
}
var contextTyp = reflect.TypeOf((*context.Context)(nil)).Elem()
// IsContext returns true if the "inTyp" is a type of Context.
func IsContext(inTyp reflect.Type) bool {
return inTyp.Implements(contextTyp)
}
func goodFunc(fn reflect.Type) bool {
// valid if that single input arg is a typeof context.Context
// or first argument is context.Context and second argument is a variadic, which is ignored (i.e new sessions#Start).
return (fn.NumIn() == 1 || (fn.NumIn() == 2 && fn.IsVariadic())) && IsContext(fn.In(0))
}
// IsFunc returns true if the passed type is function.
func IsFunc(kindable interface {
Kind() reflect.Kind