Documentation ¶
Index ¶
- type ResponseController
- func (c *ResponseController) AppendItems(items ...interface{})
- func (c *ResponseController) AppendLinks(links ...ResponseLink)
- func (c *ResponseController) AppendOffsetLimitSize(offset, limit, size int)
- func (c *ResponseController) GetOffsetLimit() (offset, limit int)
- func (c *ResponseController) Prepare()
- func (c *ResponseController) SendResponse(code int, msg ...interface{})
- type ResponseLink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseController ¶
type ResponseController struct { beego.Controller InputURL string Code int Res struct { Href string `json:"href,omitempty"` Message string `json:"message,omitempty"` Size int `json:"size,omitempty"` Offset int `json:"offset,omitempty"` Limit int `json:"limit,omitempty"` Links []ResponseLink `json:"links,omitempty"` Items []interface{} `json:"items,omitempty"` Errors map[string]interface{} `json:"errors,omitempty"` } }
ResponseController is used for all ResponseControllers and contains the most basic elements
func (*ResponseController) AppendItems ¶
func (c *ResponseController) AppendItems(items ...interface{})
AppendItems appends items to the response
func (*ResponseController) AppendLinks ¶
func (c *ResponseController) AppendLinks(links ...ResponseLink)
AppendLinks appends links to the response
func (*ResponseController) AppendOffsetLimitSize ¶
func (c *ResponseController) AppendOffsetLimitSize(offset, limit, size int)
AppendOffsetLimitSize appends offset and limit to output next/previous/all-links
func (*ResponseController) GetOffsetLimit ¶
func (c *ResponseController) GetOffsetLimit() (offset, limit int)
GetOffsetLimit checks input offset/limit, and sets default values if not found
func (*ResponseController) Prepare ¶
func (c *ResponseController) Prepare()
Prepare is used to prepare the ResponseController
func (*ResponseController) SendResponse ¶
func (c *ResponseController) SendResponse(code int, msg ...interface{})
SendResponse sets JSON output formatted for web
type ResponseLink ¶
type ResponseLink struct { Rel string `json:"rel,omitempty"` Method string `json:"method"` Href string `json:"href" ` }
ResponseLink is used to reference other rescources in the API
Click to show internal directories.
Click to hide internal directories.