mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 10:57:05 +00:00
I, think, that binders are done, both dynamic functions with different results every time (based on the context) and static services (interface as input(to give the devs the chance make better and most testable code) and struct or both are structs)
Former-commit-id: eb395b06003ea9eae005a36c9c6be0ef63c4d41d
This commit is contained in:
21
mvc2/handler.go
Normal file
21
mvc2/handler.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mvc2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/kataras/iris/context"
|
||||
)
|
||||
|
||||
// checks if "handler" is context.Handler; func(context.Context).
|
||||
func isContextHandler(handler interface{}) bool {
|
||||
_, is := handler.(context.Handler)
|
||||
return is
|
||||
}
|
||||
|
||||
func validateHandler(handler interface{}) error {
|
||||
if typ := reflect.TypeOf(handler); !isFunc(typ) {
|
||||
return fmt.Errorf("handler expected to be a kind of func but got typeof(%s)", typ.String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user