请求处理常见tag语法

type InputStructure struct {
Content string `form:"content" binding:"required,len=2"`
Age int `form:"age" binding:"max=10,min=1"`
Pass string `form:"pass" binding:"gte=6"` // 字母和数字
ConfirmPass string `form:"cpass" binding:"eqfield=Pass"` // 与上一个域相同
FileName string `form:"fname" binding:"gte=2,alphanum"` // 字母和数字
Email string `form:"email" binding:"email"`
//Body string `form:"base64" binding:"base64"` // startswith=hello, endswith=hello, contains=@, uuid, ip
}

posted @ 2020-07-03 18:24  jacktu  阅读(194)  评论(0编辑  收藏  举报