Environment

github.com/gin-gonic/gin v1.9.1 windows

Description

I want to enter the gin framework in the request parameters, binding parameters can customize some operations, such as html escape, to avoid security problems, such as myFilter to do an encryption and decryption operation, did not find a solution

Example code

type AdminRequest struct {
    ID       int64  `form:"id" json:"id"`                                // 用户ID
    Name     string `form:"name" json:"name" filter:"html.EscapeString"` // 系统管理用户名
    Password string `form:"password" json:"password" filter:"myFilter"`  // 密码
    Page     int    `form:"page" json:"page"`                            // 页码
    PageSize int    `form:"pageSize" json:"pageSize"`                    // 页大小
}

like ‘json form use flag to get parameter name filter to customize some operations