responsex

package
v0.0.0-...-d763768 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const CreatedSuccess = "创建成功!"
View Source
const DeletedFail = "删除失败!"
View Source
const DeletedSuccess = "删除成功!"
View Source
const GetSuccess = "查询成功!"
View Source
const NotFound = "未找到相关内容或者数据为空!"
View Source
const TimeOut = "操作超时!"
View Source
const UpdatedSuccess = "更新成功!"

Variables

This section is empty.

Functions

func Custom

func Custom(ctx *gin.Context, data gin.H)

Custom 兼容函数

func Error

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

Error 失败数据处理

func OK

func OK(ctx *gin.Context, data interface{}, msg string)

OK 通常成功数据处理

func PageOK

func PageOK(ctx *gin.Context, result interface{}, count int, pageIndex int, pageSize int, msg string)

PageOK 分页数据处理

Types

type Page

type Page struct {
	List      interface{} `json:"list"`
	Count     int         `json:"count"`
	PageIndex int         `json:"pageIndex"`
	PageSize  int         `json:"pageSize"`
}

type PageResponse

type PageResponse struct {
	// 状态码
	Code int `json:"code" example:"200"`
	// 消息
	Msg string `json:"msg"`
	// 数据集
	Data Page `json:"data"`
}

func (*PageResponse) ReturnOK

func (res *PageResponse) ReturnOK() *PageResponse

type Response

type Response struct {
	// 状态码
	Code int `json:"code" example:"200"`
	// 消息
	Msg string `json:"msg"`
	// 数据集
	Data interface{} `json:"data"`
}

func (*Response) ReturnError

func (res *Response) ReturnError(code int) *Response

func (*Response) ReturnOK

func (res *Response) ReturnOK() *Response

Jump to

Keyboard shortcuts

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