response

package
v0.0.0-...-ac3b76c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &response{}

Functions

func Custum

func Custum(c *gin.Context, data gin.H)

Custum 兼容函数

func Error

func Error(c *gin.Context, code int, err error, msg string)

Error 失败数据处理

func OK

func OK(c *gin.Context, data any, msg string)

OK 通常成功数据处理

func PageOK

func PageOK(c *gin.Context, result any, count int, pageIndex int, pageSize int, msg string)

PageOK 分页数据处理

Types

type Page

type Page struct {
	Count     int `json:"count"`
	PageIndex int `json:"page_index"`
	PageSize  int `json:"page_size"`
}

type Response

type Response struct {
	RequestId string `json:"requestId,omitempty"`
	Code      int32  `json:"code,omitempty"`
	Info      string `json:"info,omitempty"`
	Msg       string `json:"msg,omitempty"`
	Status    string `json:"status,omitempty"`
}

type Responses

type Responses interface {
	SetCode(int32)
	SetTraceID(string)
	SetMsg(string)
	SetInfo(string)
	SetData(interface{})
	SetSuccess(bool)
	Clone() Responses
}

Jump to

Keyboard shortcuts

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