response

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Custum

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

Custum 兼容函数

func Error

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

Error 失败数据处理

func OK

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

OK 通常成功数据处理

func PageOK

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

PageOK 分页数据处理

Types

type Page

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

type Response

type Response struct {
	Code int         `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
	Msg  string      `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
	Data interface{} `json:"data"`
}

func (*Response) GetCode added in v1.0.12

func (e *Response) GetCode() int

func (*Response) SetCode added in v1.0.12

func (e *Response) SetCode(code int)

func (*Response) SetData added in v1.0.12

func (e *Response) SetData(data interface{})

func (*Response) SetMsg added in v1.0.12

func (e *Response) SetMsg(s string)

type Responses

type Responses interface {
	SetCode(int)
	GetCode() int
	SetMsg(string)
	SetData(interface{})
}

func CreateResponse

func CreateResponse(c *gin.Context, code int, msg string) Responses

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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