http

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 正常
	OK int = 0
	// 参数错误
	ParamsError int = 4001
	// 数据错误
	DataError int = 4002
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	// 是否成功
	Success bool `json:"success"`
	// 错误代码
	ErrorCode int `json:"error_code"`
	// 消息
	Message string `json:"message"`
	// 数据项
	Data interface{} `json:"data"`
}

Response Http响应

func NewResponse

func NewResponse(errCode int, msg string, data ...interface{}) *Response

NewResponse 创建响应

func NewResponseError

func NewResponseError(err interface{}, data ...interface{}) *Response

NewResponseError 创建错误响应, 显示原始错误

func NewResponseOK

func NewResponseOK(msg string, data ...interface{}) *Response

NewResponseOK 创建成功响应

Jump to

Keyboard shortcuts

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