handler

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

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

BadRequest 返回 400 错误

func BindJSON

func BindJSON(c *gin.Context, req any) error

BindJSON 绑定 JSON 请求

func BindQuery

func BindQuery(c *gin.Context, req any) error

BindQuery 绑定 Query 参数

func FormBool

func FormBool(c *gin.Context, key string, def bool) bool

FormBool 获取 POST 表单参数中的布尔值(带默认值)

func FormFloat64

func FormFloat64(c *gin.Context, key string, def float64) float64

FormFloat64 获取 POST 表单参数中的 float64(带默认值)

func FormInt

func FormInt(c *gin.Context, key string, def int) int

FormInt 获取 POST 表单参数中的整数(带默认值)

func FormInt64

func FormInt64(c *gin.Context, key string, def int64) int64

FormInt64 获取 POST 表单参数中的 int64(带默认值)

func FormString

func FormString(c *gin.Context, key string, def string) string

FormString 获取 POST 表单参数中的字符串(带默认值)

func FormUint64

func FormUint64(c *gin.Context, key string, def uint64) uint64

FormUint64 获取 POST 表单参数中的 uint64(带默认值)

func GetIDFromPath

func GetIDFromPath(c *gin.Context, paramName string) (uint, bool)

GetIDFromPath 从路径获取 ID

func GetPage

func GetPage(c *gin.Context) (int, int)

GetPage 获取分页参数

func HealthCheck

func HealthCheck(c *gin.Context)

HealthCheck 健康检查 @Summary 健康检查 @Description 检查服务是否正常运行 @Tags 系统 @Accept json @Produce json @Success 200 {object} response.Response @Router /health [get]

func InternalError

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

InternalError 返回 500 错误

func ParseInt

func ParseInt(s string, defaultValue int) int

ParseInt 解析整数

func PathInt

func PathInt(c *gin.Context, key string, def int) int

PathInt 从路径参数获取整数(带默认值)

func PathInt64

func PathInt64(c *gin.Context, key string, def int64) int64

PathInt64 从路径参数获取 int64(带默认值)

func PathUint64

func PathUint64(c *gin.Context, key string, def uint64) uint64

PathUint64 从路径参数获取 uint64(带默认值)

func QueryBool

func QueryBool(c *gin.Context, key string, def bool) bool

QueryBool 获取 Query 参数中的布尔值(带默认值)

func QueryFloat64

func QueryFloat64(c *gin.Context, key string, def float64) float64

QueryFloat64 获取 Query 参数中的 float64(带默认值)

func QueryInt

func QueryInt(c *gin.Context, key string, def int) int

QueryInt 获取 Query 参数中的整数(带默认值)

func QueryInt64

func QueryInt64(c *gin.Context, key string, def int64) int64

QueryInt64 获取 Query 参数中的 int64(带默认值)

Types

This section is empty.

Jump to

Keyboard shortcuts

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