xcode

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CodeBreakUp uint32 = 9999
	SystemType         = iota
	BusinessType
)

CodeBreakUp 低于10000均为系统错误码,业务错误码请使用10000以上

Variables

View Source
var (

	// OK ...
	OK      = add(SystemType, uint32(codes.OK), "OK")
	Unknown = add(SystemType, uint32(codes.Unknown), "UNKNOWN")
)

Functions

func BusinessCode

func BusinessCode(code uint32) (spb *spbStatus)

func BusinessCodeAdd

func BusinessCodeAdd(code uint32, message string) *spbStatus

func CodeAdds

func CodeAdds(data []CodeInfo)

func ExtractCodes

func ExtractCodes(e error) *spbStatus

ExtractCodes cause from error to ecode.

func SystemCode

func SystemCode(code uint32) (spb *spbStatus)

func SystemCodeAdd

func SystemCodeAdd(code uint32, message string) *spbStatus

func XCodeBusinessCodeHttp

func XCodeBusinessCodeHttp(w http.ResponseWriter, r *http.Request)

func XCodeSystemCodeHttp

func XCodeSystemCodeHttp(w http.ResponseWriter, r *http.Request)

Types

type CodeInfo

type CodeInfo struct {
	CodeT   uint
	Code    uint32
	Message string
}

Jump to

Keyboard shortcuts

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