response

package
v0.0.0-...-dab46ad Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(m map[code.ResultCode]string)

Types

type Base

type Base struct {
	Code      code.ResultCode `json:"code"`             //业务状态码
	Status    bool            `json:"status"`           //状态【code==200】
	Msg       string          `json:"msg"`              //提示消息 一般为状态码对应信息
	RequestID interface{}     `json:"req_id,omitempty"` //请求ID
	Desc      string          `json:"desc,omitempty"`   //Error信息
}

Base 统一返回对象

func NewResponse

func NewResponse(ctx context.Context, resultCode code.ResultCode, err error) Base

NewResponse 根据业务状态码和err信息创建新的结构返回

func NewSuccessResponse

func NewSuccessResponse(ctx context.Context) Base

NewSuccessResponse success response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳