callback

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForm = Msg{
		Code:       cErrForm,
		Msg:        "参数错误,请反馈开发者",
		HttpStatus: 400,
	}
	ErrMode = Msg{
		Code:       cErrMode,
		Msg:        "运行模式异常,请反馈开发者",
		HttpStatus: 403,
	}
	ErrFileOperation = Msg{
		Code:       cErrFileOperation,
		Msg:        "文件操作失败",
		HttpStatus: 500,
	}
	ErrNotDir = Msg{
		Code:       cErrNotDir,
		Msg:        "目标路径不是文件夹",
		HttpStatus: 403,
	}
	ErrFileNotFound = Msg{
		Code:       cErrFileNotFound,
		Msg:        "文件不存在",
		HttpStatus: 404,
	}
	ErrNotFile = Msg{
		Code:       cErrNotFile,
		Msg:        "目标路径是文件夹",
		HttpStatus: 403,
	}
)

Functions

func Default

func Default(c *gin.Context)

func Error

func Error(c *gin.Context, msg Msg, args ...any)

func ErrorWithTip

func ErrorWithTip(c *gin.Context, msg Msg, tip any, args ...any)

func Success

func Success(c *gin.Context, data interface{})

Types

type Msg

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

Jump to

Keyboard shortcuts

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