rest

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BizError = iota + 10001
	ParseError
	MysqlError
	RedisError
	TokenError
)

Variables

This section is empty.

Functions

func Response

func Response(w http.ResponseWriter, resp interface{}, err error)

Types

type BaseError

type BaseError struct {
	Msg  string `json:"msg"`  //错误信息
	Code int    `json:"code"` //错误码
	Err  error
}

func MustBizError

func MustBizError(msg string, err error) BaseError

func MustDefaultError

func MustDefaultError(err error) BaseError

func MustError

func MustError(code int, msg string, err error) BaseError

func MustMysqlError added in v0.1.4

func MustMysqlError(msg string, err error) BaseError

func MustParseError added in v0.1.4

func MustParseError(msg string, err error) BaseError

func MustRedisError added in v0.1.4

func MustRedisError(msg string, err error) BaseError

func MustTokenError added in v0.1.4

func MustTokenError(msg string, err error) BaseError

func (BaseError) Error

func (b BaseError) Error() string

type Body

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

Jump to

Keyboard shortcuts

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