res

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Status  int         `json:"status"`
	Data    interface{} `json:"data"`
	Msg     string      `json:"msg"`
	Error   string      `json:"error"`
	TrackId string      `json:"track_id"`
}

Response 基础序列化器

func RespSuccess

func RespSuccess(ctx *gin.Context, data interface{}, code ...int) *Response

RespSuccess 带data成功返回

type TrackedErrorResponse

type TrackedErrorResponse struct {
	Response
	TrackId string `json:"track_id"`
}

TrackedErrorResponse 有追踪信息的错误反应

func RespError

func RespError(ctx *gin.Context, err error, data string, code ...int) *TrackedErrorResponse

RespError 错误返回

Jump to

Keyboard shortcuts

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