respond

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert400

func Alert400(c *gin.Context, code Code, message string)

Alert400 客户端请求错误

func Alert400WithoutMessage

func Alert400WithoutMessage(c *gin.Context, code Code)

Alert400WithoutMessage 客户端请求错误 不传具体信息

func Alert404Route

func Alert404Route(router *gin.Engine)

Alert404Route 路由不存在

func Alert500

func Alert500(c *gin.Context, code Code, message string)

Alert500 系统错误

func Alert500WithoutMessage

func Alert500WithoutMessage(c *gin.Context, code Code)

Alert500WithoutMessage 系统错误 不传具体信息

func Fail

func Fail(c *gin.Context, err error)

Fail 请求失败

func StatusText

func StatusText(code Code) string

func Success

func Success(c *gin.Context)

Success 请求成功

func SuccessWithData

func SuccessWithData(c *gin.Context, data any)

SuccessWithData 请求成功,返回结果

Types

type Code

type Code uint
const (
	StatusOK Code = 200
	Failure  Code = 1
)
const (
	StatusBadRequest Code = iota + 400000
	MissUserAgent
	StatusNotFound
)
const (
	StatusInternalServerError Code = iota + 500000
)
const (
	StatusMultipleChoices Code = iota + 300000
)

Jump to

Keyboard shortcuts

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