response

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *gin.Context, message string)

常用错误响应

func Error

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

Error 错误响应

func ErrorWithData

func ErrorWithData(c *gin.Context, code int, message string, data interface{})

ErrorWithData 错误响应(带数据)

func Forbidden

func Forbidden(c *gin.Context, message string)

func InternalServerError

func InternalServerError(c *gin.Context, message string)

func NotFound

func NotFound(c *gin.Context, message string)

func Success

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

Success 成功响应

func SuccessWithMessage

func SuccessWithMessage(c *gin.Context, message string, data interface{})

SuccessWithMessage 成功响应(自定义消息)

func Unauthorized

func Unauthorized(c *gin.Context, message string)

Types

type Response

type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

Response 统一响应结构

Jump to

Keyboard shortcuts

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