handler

package
v0.0.0-...-4ea7438 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ERROR ERROR
	ERROR = -999
	// SUCCESS SUCCESS
	SUCCESS = 0
)
View Source
const (
	// CodeOK CodeOK
	CodeOK = 0
	// CodeErr CodeErr
	CodeErr = 500 // 内部错误
	// CodeErr301 CodeErr301
	CodeErr301 = 301 // 未授权
	// CodeErr401 CodeErr401
	CodeErr401 = 401 // 拒绝访问
	// CodeErr404 CodeErr404
	CodeErr404 = 404 // 没有找到
	// CodeParamErr CodeParamErr
	CodeParamErr = 501 // 入参错误
	// CodeSQLErr CodeSQLErr
	CodeSQLErr = 502 // sql 错误
	// MsgOK MsgOK
	MsgOK = "操作成功"
	// MsgErr MsgErr
	MsgErr = "操作失败"
	// MsgErr301 MsgErr301
	MsgErr301 = "未授权!"
	// MsgErr401 MsgErr401
	MsgErr401 = "拒绝访问!"
	// MsgErr404 MsgErr404
	MsgErr404 = "没有找到!"
)
View Source
const (
	// ApplicationJSON ApplicationJSON
	ApplicationJSON = "application/json"
)

Variables

This section is empty.

Functions

func JSON

func JSON(c *gin.Context, code int, msg string, data ...interface{})

JSON JSON

func Parse

func Parse(c *gin.Context, req interface{}) error

Parse Parse

func Translate

func Translate(err error) string

Translate Translate

Types

type CustomError

type CustomError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

CustomError CustomError

type Response

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

Response Response

Jump to

Keyboard shortcuts

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