Exemplo n.º 1
0
Arquivo: adapter.go Projeto: hgoo/hgoo
func (this *RouteAdapter) checkMethod(runMethod string) (router *routeMapping, verifi bool) {
	value := reflect.ValueOf(this.Route)
	reflect := reflect.Indirect(value).Type()
	if funcName := value.MethodByName(runMethod); funcName.IsValid() {
		return &routeMapping{
			reflect:   reflect,
			runMethod: runMethod,
			pattern:   this.Pattern,
		}, true
	} else {
		log.E("'%s' method doesn't exist in the router %s", nil, runMethod, reflect.Name())
		return nil, false
	}
}
Exemplo n.º 2
0
func Name(t reflect.Type, pkgPath, name string) reflect.Type {
	return reflect.Name(t, pkgPath, name)
}