gin – validator 参数校验
2012 年 10 月 30 日
准备工作完成,接下来让我们来使用他
package controller type Register struct { Mobile uint `json:"mobile" binding:"required,checkMobile"` Password string `json:"password" binding:"required,gte=6"` }
这个阶段已经完成,我们可以满足我们常见的参数验证场景了,但是还不够完美,哪里不够完美呢,提示信息,现在我们看到的提示信息是英文的,身为一个中国人,我们当然要提示中文才显得更加友好,所以接下来我们做汉化展示。