codes

package
v0.3.5-0...-112653b Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package code to define some code

Index

Constants

View Source
const (
	// CodeOK 0
	CodeOK = iota
	// CodeParamInvalid ...
	CodeParamInvalid
	// CodeSystemErr ...
	CodeSystemErr
	// CodeNoPermission ...
	CodeNoPermission
	// CodeServerTimeout ...
	CodeServerTimeout
	// CodeResourceNotFound ...
	CodeResourceNotFound
	// CodeIllegeOP ...
	CodeIllegeOP
	// ErrNoSuchCode ...
	ErrNoSuchCode = "错误码未定义"
)

Variables

This section is empty.

Functions

func Fill

func Fill(v interface{}, ci *Proto) interface{}

Fill ... fill a response struct will *Proto TODO: validate v

func GetMessage

func GetMessage(code int) string

GetMessage get code desc from messages

Types

type Proto

type Proto struct {
	ErrCode    int    `json:"errcode"`
	ErrMessage string `json:"errmsg"`
}

Proto define a Proto type

func Get

func Get(code int) *Proto

Get get Proto with specified code

func New

func New(code int, message string) *Proto

New create a new *Proto

Jump to

Keyboard shortcuts

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