Example #1
0
// 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())
}
Example #2
0
// 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)
}
Example #3
0
// Add a static route to a controller method
func ForwardPermalinkToMethod(url, method string) {
	module := utils.GetCallingPackageName()
	router.AddStaticRoute(url, module, method)
}
Example #4
0
// 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)
}
Example #5
0
// Set the default controller method for this module
func DefaultMethod(method string) {
	module := utils.GetCallingPackageName()
	router.DefaultMethodForModule(module, method)
}