Documentation ¶
Overview ¶
Implements boilerplate code for all baseControllers
Index ¶
- type BaseController
- func (baseController *BaseController) AjaxResponse(resultCode int, resultString string, data interface{})
- func (baseController *BaseController) CatchPanic(functionName string)
- func (baseController *BaseController) Finish()
- func (baseController *BaseController) ParseAndValidate(params interface{}) bool
- func (baseController *BaseController) Prepare()
- func (baseController *BaseController) ServeError(err error)
- func (baseController *BaseController) ServeValidationErrors(errors []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseController ¶
type BaseController struct { beego.Controller services.Service }
BaseController composes all required types and behavior
func (*BaseController) AjaxResponse ¶
func (baseController *BaseController) AjaxResponse(resultCode int, resultString string, data interface{})
AjaxResponse returns a standard ajax response
func (*BaseController) CatchPanic ¶
func (baseController *BaseController) CatchPanic(functionName string)
CatchPanic is used to catch any Panic and log exceptions. Returns a 500 as the response
func (*BaseController) Finish ¶
func (baseController *BaseController) Finish()
Finish is called once the baseController method completes
func (*BaseController) ParseAndValidate ¶
func (baseController *BaseController) ParseAndValidate(params interface{}) bool
ParseAndValidate will run the params through the validation framework and then response with the specified localized or provided message
func (*BaseController) Prepare ¶
func (baseController *BaseController) Prepare()
Prepare is called prior to the baseController method
func (*BaseController) ServeError ¶
func (baseController *BaseController) ServeError(err error)
ServeError prepares and serves an error exception
func (*BaseController) ServeValidationErrors ¶
func (baseController *BaseController) ServeValidationErrors(errors []string)
ServeValidationErrors prepares and serves a validation exception
Click to show internal directories.
Click to hide internal directories.