response

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

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK      = 200 // 请求成功
	Created = 201 // 创建成功

	Bad = 400 // 参数错误
	// UnAuth    = 401 // 未经授权
	// Forbidden = 403 // 禁止请求
	NotFind  = 404 // 找不到
	TooLarge = 413 // 请求过大
	TooMany  = 429 // 请求频繁

	ServerErr = 500 // 服务器错误
)

Variables

This section is empty.

Functions

func Error

func Error(c *gin.Context, status int, message string)

func Ok

func Ok(c *gin.Context, status int, data interface{}, message string)

Types

type Response

type Response struct {
	Status  int         `json:"code"` // 响应状态码
	Data    interface{} `json:"data"` //返回内容
	Message string      `json:"msg"`  // 返回消息
}

Jump to

Keyboard shortcuts

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