request

package
v0.0.0-...-eea11df Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSONIgnoreCase

func BindJSONIgnoreCase(c *gin.Context, req interface{}) (err error)

把请求参数转换为小写

func ShouldBind

func ShouldBind(c *gin.Context, req interface{}) error

func ShouldBindJSON

func ShouldBindJSON(c *gin.Context, req interface{}) error

func ShouldBindQuery

func ShouldBindQuery(c *gin.Context, req interface{}) error

Types

type Context

type Context struct {
	context.Context `json:"-" header:"-"`
	Token           string `json:"token" header:"token" example:""`
	Uid             int64  `json:"uid" header:"-" example:""`
	IpAddress       string `json:"ip_address" header:"-" example:""`
	UserAgent       string `json:"user_agent" header:"-" example:""`
}

请求上下文,一般存放请求头参数

func ParseRequestContext

func ParseRequestContext(c *gin.Context) (*Context, error)

获取请求上下文

func (*Context) GetContext

func (s *Context) GetContext() context.Context

type EmptyReq

type EmptyReq struct{}

type IdReq

type IdReq struct {
	Id int64 `json:"id" form:"id" binding:"required"`
}

type IdsReq

type IdsReq struct {
	Ids []int64 `json:"ids" form:"ids" binding:"required"`
}

type IsValidChecker

type IsValidChecker interface {
	IsValid() error
}

Jump to

Keyboard shortcuts

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