ControllerActivator returns a new controller type info description. Its functionality can be overridden by the end-dev.
| 72 | // ControllerActivator returns a new controller type info description. |
| 73 | // Its functionality can be overridden by the end-dev. |
| 74 | type ControllerActivator struct { |
| 75 | app *Application |
| 76 | |
| 77 | injector *hero.Struct |
| 78 | |
| 79 | // initRef BaseController // the BaseController as it's passed from the end-dev. |
| 80 | Value reflect.Value // the BaseController's Value. |
| 81 | Type reflect.Type // raw type of the BaseController (initRef). |
| 82 | // FullName it's the last package path segment + "." + the Name. |
| 83 | // i.e: if login-example/user/controller.go, the FullName is "user.Controller". |
| 84 | fullName string |
| 85 | |
| 86 | // the already-registered routes, key = the controller's function name. |
| 87 | // End-devs can change some properties of the *Route on the `BeforeActivator` by using the |
| 88 | // `GetRoute/GetRoutes(functionName)`. |
| 89 | routes map[string][]*router.Route |
| 90 | |
| 91 | skipMethodNames []string |
| 92 | // BeginHandlers is a slice of middleware for this controller. |
| 93 | // These handlers will be prependend to each one of |
| 94 | // the route that this controller will register(Handle/HandleMany/struct methods) |
| 95 | // to the targeted Party. |
| 96 | // Look the `Use` method too. |
| 97 | BeginHandlers context.Handlers |
| 98 | |
| 99 | // true if this controller listens and serves to websocket events. |
| 100 | servesWebsocket bool |
| 101 | |
| 102 | // true to skip the internal "activate". |
| 103 | activated bool |
| 104 | } |
| 105 | |
| 106 | // NameOf returns the package name + the struct type's name, |
| 107 | // it's used to take the full name of an Controller, the `ControllerActivator#Name`. |
nothing calls this directly
no outgoing calls
no test coverage detected