gin 框架内置验证器文档
https://godoc.org/gopkg.in/go-playground/validator.v10
验证器的试用列子
type Topic2 struct { TopicId int `json:"topic_id" ` TopicTitle string `json:"topic_title" form:"topic_title" binding:"min=4,max=20"` //4-20 TopicShortTitle string `json:"stitle" binding:"required,nefield=TopicTitle"` //值不能等于 TopicTitle字段的值 UserIp int `json:"ip" binding:"ip"` // 必须是ip TopicScore int `json:"score" binding:"gt=10"` // 必须大于10 }