code

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 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 FillCodeInfo

func FillCodeInfo(v interface{}, ci *CodeInfo) interface{}

FillCodeInfo ... fill a response struct will *CodeInfo TODO: validate v

func GetMessage

func GetMessage(code int) string

GetMessage get code desc from messages

Types

type CodeInfo

type CodeInfo struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

CodeInfo define a CodeInfo type

func GetCodeInfo

func GetCodeInfo(code int) *CodeInfo

GetCodeInfo get CodeInfo with specified code

func NewCodeInfo

func NewCodeInfo(code int, message string) *CodeInfo

NewCodeInfo create a new *CodeInfo

Jump to

Keyboard shortcuts

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