models

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCode = map[string]ErrorValue{
	"success":         {Code: 0, Msg: "", Log: ""},
	"SerError":        {Code: 100001, Msg: "服务请求失败!", Log: "服务【%s】请求失败:%s"},
	"SerResEmpty":     {Code: 100002, Msg: "服务请求返回为空!", Log: "服务【%s】请求返回为空!"},
	"SerResJosnError": {Code: 100003, Msg: "服务请求返回内容错误!", Log: "服务【%s】请求返回内容错误:%s"},
}

ErrorCode 全局返回码

Functions

This section is empty.

Types

type ErrorValue

type ErrorValue struct {
	Code int
	Msg  string
	Log  string
}

ErrorValue 错误值配置

type Response

type Response struct {
	Code   int         `json:"code"`
	Data   interface{} `json:"data,omitempty"`
	ErrMsg interface{} `json:"errmsg,omitempty"`
}

Response 接口输出类

func NewDefaultResponse

func NewDefaultResponse() *Response

NewDefaultResponse 默认 Response

func NewErrorResponse

func NewErrorResponse(s *error.Status) *Response

NewErrorResponse 错误 Response

func NewResponse

func NewResponse(code int, data interface{}, err interface{}) *Response

NewResponse 自定义 Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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