MCPcopy
hub / github.com/revel/revel / ControllerTypeByName

Function ControllerTypeByName

controller.go:433–451  ·  view source on GitHub ↗
(controllerName string, moduleSource *Module)

Source from the content-addressed store, hash-verified

431}
432
433func ControllerTypeByName(controllerName string, moduleSource *Module) (c *ControllerType) {
434 var found bool
435 if c, found = controllers[controllerName]; !found {
436 // Backup, passed in controllerName should be in lower case, but may not be
437 if c, found = controllers[strings.ToLower(controllerName)]; !found {
438 controllerLog.Debug("ControllerTypeByName: Cannot find controller in controllers map ", "controller", controllerName)
439 // Search for the controller by name
440 for _, cType := range controllers {
441 testControllerName := strings.ToLower(cType.Type.Name())
442 if testControllerName == strings.ToLower(controllerName) && (cType.ModuleSource == moduleSource || moduleSource == anyModule) {
443 controllerLog.Warn("ControllerTypeByName: Matched empty namespace controller ", "controller", controllerName, "namespace", cType.ModuleSource.Name)
444 c = cType
445 break
446 }
447 }
448 }
449 }
450 return
451}
452
453// Injects this instance (c) into the AppController instance.
454func (c *Controller) setAppControllerFields() {

Callers 2

ReverseErrorMethod · 0.85
SetTypeActionMethod · 0.85

Calls 3

DebugMethod · 0.80
WarnMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected