errcode

package
v0.0.0-...-45e8f3b Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR   = iota - 1 // -1
	SUCCESS            // 0
	FAILURE
)
View Source
const (
	NOLOGIN      = 402
	NOPERMISSION = 403
	NOFOUND      = 404
)
View Source
const (
	EMPTY_DATA = iota + 1000
	EXISTS_DATA
	NO_EXISTS_DATA
	ILLEGAL_PARAM
)
View Source
const (
	QUERY_ERROR = iota + 10000
	UPDATE_ERROR
	INSERT_ERROR
	DELETE_ERROR
)
View Source
const (
	NO_OPEN_CMNT = iota + 100000
)

Variables

View Source
var (
	Error   = NewErrcode(ERROR, nil)
	Success = NewErrcode(SUCCESS, nil)
	Failure = NewErrcode(FAILURE, nil)

	NoLogin      = NewErrcode(NOLOGIN, nil)
	NoPermission = NewErrcode(NOPERMISSION, nil)
	NofoundError = NewErrcode(NOFOUND, nil)

	EmptyData    = NewErrcode(EMPTY_DATA, nil)
	ExsistData   = NewErrcode(EXISTS_DATA, nil)
	NoExsistData = NewErrcode(NO_EXISTS_DATA, nil)
	IllegalParam = NewErrcode(ILLEGAL_PARAM, nil)

	QueryError  = NewErrcode(QUERY_ERROR, nil)
	UpdateError = NewErrcode(UPDATE_ERROR, nil)
	InsertError = NewErrcode(INSERT_ERROR, nil)
	DeleteError = NewErrcode(DELETE_ERROR, nil)

	NoOpenCmntError = NewErrcode(NO_OPEN_CMNT, nil)
)

常用

Functions

This section is empty.

Types

type ErrCode

type ErrCode struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func NewErrcode

func NewErrcode(code int, data interface{}) *ErrCode

func (*ErrCode) AddMsg

func (e *ErrCode) AddMsg(msg ...interface{}) *ErrCode

func (*ErrCode) GetErrCode

func (e *ErrCode) GetErrCode() *ErrCode

func (*ErrCode) IsSuccess

func (e *ErrCode) IsSuccess() bool

func (*ErrCode) String

func (e *ErrCode) String() string

func (*ErrCode) WithData

func (e *ErrCode) WithData(data interface{}) *ErrCode

func (*ErrCode) WithPage

func (e *ErrCode) WithPage(page *common.Page, data interface{}) *ErrCode

Jump to

Keyboard shortcuts

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