handlers

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess = 0
	CodeErrApp  = iota + 1000
	CodeErrMsg
	CodeErrParam
	CodeErrNoPriv
)

Variables

View Source
var MsgFlags = map[int]string{
	CodeErrApp:    "内部错误",
	CodeSuccess:   "成功",
	CodeErrMsg:    "未知错误",
	CodeErrParam:  "参数错误",
	CodeErrNoPriv: "沒有权限",
}

Functions

func GetMsg

func GetMsg(code int) string

GetMsg get error information based on Code

func NewInfo

func NewInfo(err error) string

Types

type Gin

type Gin struct {
	*gin.Context
}

func (*Gin) SaveFiles

func (g *Gin) SaveFiles(filePath string) error

SaveFiles 保存为本地文件

func (*Gin) SaveToTarFile

func (g *Gin) SaveToTarFile(filePath string) error

SaveToTarFile 保存为tar压缩文件

func (*Gin) SetError

func (g *Gin) SetError(code int, err error)

SetError Check Error

func (*Gin) SetJson

func (g *Gin) SetJson(res interface{})

SetJson Set Json

func (*Gin) SetRes

func (g *Gin) SetRes(res interface{}, err error, code int)

SetRes Response res

type Info

type Info struct {
	Ok      bool   `json:"ok" description:"状态" example:"true"`
	Message string `json:"message,omitempty" description:"消息" example:"消息"`
}

type JSONResult

type JSONResult struct {
	Code    int         `json:"code" description:"返回码" example:"0000"`
	Message string      `json:"message,omitempty" description:"消息" example:"消息"`
	Data    interface{} `json:"data" description:"数据"`
}

func NewRes

func NewRes(data interface{}, err error, code int) *JSONResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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