ecode

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client uint

端口

const (
	ClientDefault             Client = iota // 默认
	ClientWeb                               // Web 端口
	ClientH5                                // H5 端口
	ClientApp                               // APP 端口(不分设备类型)
	ClientIOS                               // IOS 设备端口
	ClientAndroid                           // 安卓设备端口
	ClientWechatPublicAccount               // 微信公众号端口
	ClientWechatMiniProgram                 // 微信小程序端口
)

type Config

type Config struct {
	Client     Client     // 错误码显示的端口
	Repository Repository // 资源仓库
}

type Entity

type Entity interface {
	GetCode() int       // 错误码
	GetClient() int     // 错误显示的端口(客户端)
	GetHttpStatus() int // HTTP 状态码
	GetMessage() string // 错误消息
}

错误码实体 唯一建:Code + Client

type Repository

type Repository interface {
	// 通过 error code 搜索所有错误码定义
	FindByCode(code int) ([]Entity, error)
}

Jump to

Keyboard shortcuts

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