// Set the base model and view for the controller func (c *BaseController) SetModelAndView(m Model, v View) { // A rather obtuse way of getting things right // However, this has been thought through, and it is how you get things // working correctly in Go m.setParent(c) v.setParent(c) // Set the module name for the view v.setPackageName(utils.GetCallingPackageName()) }
// Set the invoker module as the default module // All request to "/" will be handled by this module func SetAsDefault() { module := utils.GetCallingPackageName() router.SetDefaultModule(module) }
// Add a static route to a controller method func ForwardPermalinkToMethod(url, method string) { module := utils.GetCallingPackageName() router.AddStaticRoute(url, module, method) }
// Register the request handler for the module. // All requests to the module will be handled by this function func RegisterRequestHandler(handler http.HandlerFunc) { module := utils.GetCallingPackageName() router.AddModuleHandler(module, handler) }
// Set the default controller method for this module func DefaultMethod(method string) { module := utils.GetCallingPackageName() router.DefaultMethodForModule(module, method) }