common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ERROR_MSG_MAP = map[ERROR]string{
	ERROR_OK:       "ok",
	ERROR_EMPTY:    "empty",
	INVALID_PARAMS: "invalid params",
}

Functions

func GetError

func GetError(errno ERROR) error

func GetErrorWithMsg

func GetErrorWithMsg(errno ERROR, msg string) error

func GetErrorf

func GetErrorf(ctx context.Context) func(format string, fields ...interface{})

func GetInfof

func GetInfof(ctx context.Context) func(format string, fields ...interface{})

func GetLogFuns

func GetLogFuns(ctx context.Context) (func(format string, fields ...interface{}), func(format string, fields ...interface{}))

func IsError

func IsError(err error, errno ERROR) bool

Types

type DbType

type DbType int
const (
	MysqlDb DbType = iota + 1
)

type ERROR

type ERROR int
const (
	ERROR_OK ERROR = iota
	ERROR_EMPTY
	INVALID_PARAMS
)

type Error

type Error struct {
	Errno  ERROR  `json:"errno"`
	ErrMsg string `json:"errmsg"`
}

func (*Error) Error

func (e *Error) Error() string

type ShortLinkType

type ShortLinkType int
const (
	TemporaryShortLink ShortLinkType = iota + 1
	PermanentShortLink
)

Jump to

Keyboard shortcuts

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