response

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SuccessStatus = 0
	FailStatus    = -1

	MsgOK   = "ok"
	MsgFail = "fail"
)

Variables

This section is empty.

Functions

func DisableResponseRecover

func DisableResponseRecover()

func EnableResponseRecover

func EnableResponseRecover()

func Fail

func Fail(ctx *gin.Context)

func FailAndAbort

func FailAndAbort(ctx *gin.Context)

func FailWithCode

func FailWithCode(ctx *gin.Context, code int, msg string)

func FailWithCodeAndAbort

func FailWithCodeAndAbort(ctx *gin.Context, code int, msg string)

func FailWithCodeAndNeedReload

func FailWithCodeAndNeedReload(ctx *gin.Context, code int, msg string)

func FailWithCodeAndNeedReloadAndAbort

func FailWithCodeAndNeedReloadAndAbort(ctx *gin.Context, code int, msg string)

func FailWithData

func FailWithData(ctx *gin.Context, data interface{})

func FailWithDataAndAbort

func FailWithDataAndAbort(ctx *gin.Context, data interface{})

func FailWithDetail

func FailWithDetail(ctx *gin.Context, msg string, data interface{}, showTime ...int64)

func FailWithDetailAndAbort

func FailWithDetailAndAbort(ctx *gin.Context, msg string, data interface{}, showTime ...int64)

func FailWithError

func FailWithError(ctx *gin.Context, err error, showTime ...int64)

func FailWithErrorAndAbort

func FailWithErrorAndAbort(ctx *gin.Context, err error, showTime ...int64)

func FailWithMsg

func FailWithMsg(ctx *gin.Context, msg string, showTime ...int64)

func FailWithMsgAndAbort

func FailWithMsgAndAbort(ctx *gin.Context, msg string, showTime ...int64)

func IsUseResponseRecover

func IsUseResponseRecover() bool

func Ok

func Ok(ctx *gin.Context)

func OkWithData

func OkWithData(ctx *gin.Context, data interface{})

func OkWithDetail

func OkWithDetail(ctx *gin.Context, msg string, data interface{}, showTime ...int64)

func OkWithMsg

func OkWithMsg(ctx *gin.Context, msg string, showTime ...int64)

func OkWithPageData

func OkWithPageData(ctx *gin.Context, count int64, data interface{})

Types

type CRUDResponse

type CRUDResponse struct {
	Count     int64       `json:"count"`
	Page      int64       `json:"page"`
	PageCount int         `json:"pageCount"`
	PageSize  int64       `json:"pageSize"`
	List      interface{} `json:"list"`
}

type PageData

type PageData struct {
	List     interface{} `json:"list"`
	PageSize int64       `json:"page_size"`
	Page     int64       `json:"page"`
	Total    int64       `json:"total"`
}

type PageResponse

type PageResponse struct {
	List     any              `json:"list"`
	PageInfo request.PageInfo `json:"page_info"`
}

type Response

type Response struct {
	Code           int    `json:"code"`
	Msg            string `json:"msg"`
	MsgShowTimeout int64  `json:"msg_show_timeout,omitempty"`
	Data           any    `json:"data,omitempty"`
	T              int64  `json:"t"`
}

type ResponseAbort

type ResponseAbort struct{}

ResponseAbort is used ONLY to stop gin handler chain after response has been written. It MUST be recovered by middleware.ResponseRecover.

Jump to

Keyboard shortcuts

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