Documentation
¶
Index ¶
- type APIController
- type ActionExecutedContext
- type ActionExecutingContext
- type ActionResult
- type Controller
- func (c *Controller) ClientIPCheck(req *http.Request) error
- func (c *Controller) FileResult(fielPath string) *FileResult
- func (c *Controller) GetRequest() *http.Request
- func (c *Controller) GetResponse() http.ResponseWriter
- func (c *Controller) GetViewData() map[string]interface{}
- func (c *Controller) HttpForbidden() IActionResult
- func (c *Controller) HttpForbiddenMsg(msg string) IActionResult
- func (c *Controller) HttpHtml(html string) IActionResult
- func (c *Controller) HttpInternalError(msg string) IActionResult
- func (c *Controller) HttpNotFound(msg string) IActionResult
- func (c *Controller) HttpText(text string) IActionResult
- func (c *Controller) Initialize(w http.ResponseWriter, r *http.Request)
- func (c *Controller) InitializeWS(r *http.Request)
- func (c *Controller) JsonAPIErrResult(err error) *JsonResult
- func (c *Controller) JsonResult(o interface{}) *JsonResult
- func (c *Controller) Redirect(url string) IActionResult
- func (c *Controller) View(controllerName, actionName string) IActionResult
- func (c *Controller) ViewThis() IActionResult
- type FileResult
- type IActionFilter
- type IActionResult
- type IController
- type JsonResult
- type RedirectResult
- type ResultExecutedContext
- type ResultExecutingContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIController ¶
type APIController struct {
Controller
}
func (*APIController) ClientIPCheck ¶
func (c *APIController) ClientIPCheck() error
客户端ip校验. 允许调用则返回nil, 不允许则返回err
func (*APIController) OnExecuting ¶
func (c *APIController) OnExecuting(context *ActionExecutingContext)
type ActionExecutedContext ¶
type ActionExecutedContext struct { }
type ActionExecutingContext ¶
type ActionExecutingContext struct { ActionParameters interface{} ActionName string Result IActionResult }
func NewActionExecutingContext ¶
func NewActionExecutingContext(actName string, args interface{}) *ActionExecutingContext
type ActionResult ¶
func NewActionResult ¶
func NewActionResult(code int, msg string) *ActionResult
func (*ActionResult) ExecuteResult ¶
func (ar *ActionResult) ExecuteResult(c IController)
func (*ActionResult) WriteCookie ¶
func (ar *ActionResult) WriteCookie(c IController)
type Controller ¶
type Controller struct { ViewData map[string]interface{} Response http.ResponseWriter Request *http.Request Session *session.SessionBase }
Controller , the basic controller class
func (*Controller) ClientIPCheck ¶
func (c *Controller) ClientIPCheck(req *http.Request) error
客户端ip校验. 允许调用则返回nil, 不允许则返回err
func (*Controller) FileResult ¶
func (c *Controller) FileResult(fielPath string) *FileResult
构造 FileResult
func (*Controller) GetRequest ¶
func (c *Controller) GetRequest() *http.Request
func (*Controller) GetResponse ¶
func (c *Controller) GetResponse() http.ResponseWriter
func (*Controller) GetViewData ¶
func (c *Controller) GetViewData() map[string]interface{}
func (*Controller) HttpForbidden ¶
func (c *Controller) HttpForbidden() IActionResult
func (*Controller) HttpForbiddenMsg ¶
func (c *Controller) HttpForbiddenMsg(msg string) IActionResult
func (*Controller) HttpHtml ¶
func (c *Controller) HttpHtml(html string) IActionResult
func (*Controller) HttpInternalError ¶
func (c *Controller) HttpInternalError(msg string) IActionResult
func (*Controller) HttpNotFound ¶
func (c *Controller) HttpNotFound(msg string) IActionResult
func (*Controller) HttpText ¶
func (c *Controller) HttpText(text string) IActionResult
func (*Controller) Initialize ¶
func (c *Controller) Initialize(w http.ResponseWriter, r *http.Request)
func (*Controller) InitializeWS ¶
func (c *Controller) InitializeWS(r *http.Request)
func (*Controller) JsonAPIErrResult ¶
func (c *Controller) JsonAPIErrResult(err error) *JsonResult
构造JsonAPIErrResult
func (*Controller) JsonResult ¶
func (c *Controller) JsonResult(o interface{}) *JsonResult
构造jsonResult
func (*Controller) View ¶
func (c *Controller) View(controllerName, actionName string) IActionResult
func (*Controller) ViewThis ¶
func (c *Controller) ViewThis() IActionResult
ViewThisAction return the view of caller.
type FileResult ¶
type FileResult struct {
ActionResult
}
func NewFileResult ¶
func NewFileResult(code int, filePath string) *FileResult
func (*FileResult) ExecuteResult ¶
func (ar *FileResult) ExecuteResult(c IController)
type IActionFilter ¶
type IActionFilter interface { OnExecuting(*ActionExecutingContext) OnExecuted(*ActionExecutedContext) OnResultExecuting(*ResultExecutingContext) OnResultExecuted(*ResultExecutedContext) }
ActionFilter , .
type IActionResult ¶
type IActionResult interface {
ExecuteResult(c IController)
}
func HttpInternalError ¶
func HttpInternalError(err interface{}) IActionResult
type IController ¶
type IController interface { GetViewData() map[string]interface{} GetResponse() http.ResponseWriter GetRequest() *http.Request }
type JsonResult ¶
type JsonResult struct {
ActionResult
}
func NewJsonResult ¶
func NewJsonResult(code int, msg []byte) *JsonResult
func (*JsonResult) ExecuteResult ¶
func (ar *JsonResult) ExecuteResult(c IController)
type RedirectResult ¶
type RedirectResult struct { ActionResult Permanent bool Url string }
func NewRedirectResult ¶
func NewRedirectResult(code int, url string) *RedirectResult
func (*RedirectResult) ExecuteResult ¶
func (ar *RedirectResult) ExecuteResult(c IController)
type ResultExecutedContext ¶
type ResultExecutedContext struct { }
type ResultExecutingContext ¶
type ResultExecutingContext struct { }
Click to show internal directories.
Click to hide internal directories.