data

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FailedCode 处理失败 其他错误
	FailedCode = -1
	// SucCode 处理成功
	SucCode = 200
	// 响应方内部错误
	ResponseInternalErr = 5000
	// 请求参数错误
	RequestParaErr = 1000
	// RequestErr 请求方错误
	RequestErr = 1001
	// 无权限访问错误
	UnauthorizedErr = 1002
)
View Source
const (
	FailedMsg = "failed"
	SucMsg    = "success"
)

Variables

This section is empty.

Functions

func CodeJoinMsg added in v0.0.10

func CodeJoinMsg(code int, msg ...string) (join string)

CodeJoinMsg code 对应的 信息和msg进行合拼

func CodeToMsg added in v0.0.8

func CodeToMsg(code int) (msg string, ok bool)

CodeToMsg code转换成 msg

func PutCodeMsgMap added in v0.0.12

func PutCodeMsgMap(code int, msg string)

PutCodeMsgMap 向codeMsg中设置键值对

Types

type ResultJson

type ResultJson struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

ResultJson 前后端分离开发时 约定好的标准的数据结构

func CommonErrJson added in v0.0.8

func CommonErrJson(code int, msg string, data ...interface{}) (result *ResultJson)

CommonErrJson 通用的错误返回结构

func CommonJoinMsgErrJson added in v0.0.12

func CommonJoinMsgErrJson(code int, msg string, data ...interface{}) (result *ResultJson)

CommonJoinMsgErrJson 会对msg就行合拼

func NewResultJson

func NewResultJson(code int, message string, data interface{}) (result *ResultJson)

NewResultJson 构造一个标准的数据

func OtherFailedJson

func OtherFailedJson(msg string, data ...interface{}) (result *ResultJson)

OtherFailedJson 其他错误的错误

func RequestErrJson

func RequestErrJson(msg string, data ...interface{}) (result *ResultJson)

RequestErrJson 请求端错误

func RequestParaErrJson added in v0.0.8

func RequestParaErrJson(msg string, data ...interface{}) (result *ResultJson)

RequestParaErrJson 请求参数错误

func ResponseInternalErrJson added in v0.0.5

func ResponseInternalErrJson(msg string, data ...interface{}) (result *ResultJson)

ResponseInternalErrJson 服务端内部错误

func SucJson

func SucJson(data interface{}) (result *ResultJson)

SucJson 构建一个处理成功的数据

func UnauthorizedErrJson added in v0.0.10

func UnauthorizedErrJson(msg string, data ...interface{}) (result *ResultJson)

RequestParaErrJson 请求参数错误

Jump to

Keyboard shortcuts

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