response

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 3 Imported by: 1 module, 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

This section is empty.

Variables

This section is empty.

Functions

func Error

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

Error 使用 errno.Decode 方法,根据错误类型,尝试从 err 中提取业务错误码和错误信息.

func Success

func Success(c *gin.Context, data any, message string)

Success 将正确相应数据写入 HTTP 响应主体

Types

type Response

type Response struct {
	// Code 指定了业务错误码.
	Code int `json:"code"`

	// Message 包含了可以直接对外展示的错误信息.
	Message string `json:"message"`

	// Content 包含了可以直接对外展示的数据信息
	Content interface{} `json:"content"`
}

Response 定义了发生错误时的返回消息.

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int64  `json:"expires_in"`
}

TokenResponse JWT Token 响应结构

Jump to

Keyboard shortcuts

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