rest

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 2 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(code int, msg string, err error) BaseError

func MustDefaultError

func MustDefaultError(err error) BaseError

func MustError

func MustError(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