response

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilData = struct{}{}

Functions

func Custom

func Custom(c *gin.Context, httpCode, bizCode int, msg string, data interface{})

func CustomErr added in v0.0.16

func CustomErr(c *gin.Context, httpCode, bizCode int, err error, data interface{})

func FailCheckBizErr

func FailCheckBizErr(c *gin.Context, log *log.Logger, req interface{}, title string, err error)

FailCheckBizErr 检查错误是否为业务错误,否则记录日志并响应未知

func FailErr

func FailErr(c *gin.Context, err error)

func FailMsg

func FailMsg(c *gin.Context, msg string)

func Forbidden

func Forbidden(c *gin.Context)

Forbidden 权限不足

func Success

func Success(c *gin.Context, data interface{})

func SuccessMsg

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

func SuccessNil

func SuccessNil(c *gin.Context)

func Unauthorized

func Unauthorized(c *gin.Context)

Unauthorized 未认证

func Unknown

func Unknown(c *gin.Context, err error)

func ValidateErr

func ValidateErr(c *gin.Context, err error)

ValidateErr 表单解析错误响应

func WithFieldKeysFromCtx added in v0.0.16

func WithFieldKeysFromCtx(keys ...string)

增加自定义响应字段,从上下文获取

Types

This section is empty.

Jump to

Keyboard shortcuts

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