Documentation
¶
Index ¶
- type Base
- func (c *Base) BadRequest(w http.ResponseWriter, message string)
- func (c *Base) BindJSON(r *http.Request, v interface{}) error
- func (c *Base) Forbidden(w http.ResponseWriter)
- func (c *Base) InternalServerError(w http.ResponseWriter, message string)
- func (c *Base) JSON(w http.ResponseWriter, data interface{})
- func (c *Base) JSONStatus(w http.ResponseWriter, status int, data interface{})
- func (c *Base) NotFound(w http.ResponseWriter)
- func (c *Base) Param(r *http.Request, name string) string
- func (c *Base) Params(r *http.Request) map[string]string
- func (c *Base) Redirect(w http.ResponseWriter, r *http.Request, url string)
- func (c *Base) Render(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
- func (c *Base) Text(w http.ResponseWriter, text string)
- func (c *Base) Unauthorized(w http.ResponseWriter)
- func (c *Base) UnprocessableEntity(w http.ResponseWriter, data interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct{}
Base provides common controller functionality
func (*Base) BadRequest ¶
func (c *Base) BadRequest(w http.ResponseWriter, message string)
BadRequest renders 400
func (*Base) InternalServerError ¶
func (c *Base) InternalServerError(w http.ResponseWriter, message string)
InternalServerError renders 500
func (*Base) JSON ¶
func (c *Base) JSON(w http.ResponseWriter, data interface{})
JSON renders JSON response
func (*Base) JSONStatus ¶
func (c *Base) JSONStatus(w http.ResponseWriter, status int, data interface{})
JSONStatus renders JSON with custom status code
func (*Base) Render ¶
func (c *Base) Render(w http.ResponseWriter, r *http.Request, templateName string, data interface{})
Render renders an HTML template
func (*Base) Unauthorized ¶
func (c *Base) Unauthorized(w http.ResponseWriter)
Unauthorized renders 401
func (*Base) UnprocessableEntity ¶
func (c *Base) UnprocessableEntity(w http.ResponseWriter, data interface{})
UnprocessableEntity renders 422
Click to show internal directories.
Click to hide internal directories.