1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-19 02:47:04 +00:00

implement a simple path param binder

Former-commit-id: 2edc7f115332b7afe42d6b0b1b7b6edd4a44a121
This commit is contained in:
kataras
2017-11-25 14:04:35 +02:00
parent 2448a60e04
commit 9d63e3194f
5 changed files with 177 additions and 8 deletions

View File

@@ -33,6 +33,19 @@ func isFunc(typ reflect.Type) bool {
return typ.Kind() == reflect.Func
}
/*
// no f. this, it's too complicated and it will be harder to maintain later on:
func isSliceAndExpectedItem(got reflect.Type, in []reflect.Type, currentBindersIdx int) bool {
kind := got.Kind()
// if got result is slice or array.
return (kind == reflect.Slice || kind == reflect.Array) &&
// if has expected next input.
len(in)-1 > currentBindersIdx &&
// if the current input's type is not the same as got (if it's not a slice of that types or anything else).
equalTypes(got, in[currentBindersIdx])
}
*/
func equalTypes(got reflect.Type, expected reflect.Type) bool {
if got == expected {
return true