apiresp

package
v0.0.0-...-5f8f03c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const NbReqStatusHeader = "Nb-Req-Status"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResp

type ApiResp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

func NewDetail

func NewDetail(code int, msg string, ds ...interface{}) *ApiResp

func NewErr

func NewErr(msg string, ds ...interface{}) *ApiResp

func NewResp

func NewResp(d interface{}, msgs ...string) *ApiResp

func (*ApiResp) BeegoServeJSON

func (self *ApiResp) BeegoServeJSON(c beego.Controller)

BeegoServeJSON 返回 json 内容 @deprecated

func (*ApiResp) IsSuccess

func (self *ApiResp) IsSuccess() bool

func (*ApiResp) JSON

func (self *ApiResp) JSON(ctx *context.Context, httpCode ...int)

func (*ApiResp) ReturnJSON

func (self *ApiResp) ReturnJSON(c beego.Controller, httpCode ...int)

ReturnJSON 返回 json 内容 httpCode 默认为200, 业务请求状态码在 response header 中的 "nb-req-status" 体现

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL