post的代码
r.POST("/test", func(c *gin.Context) {
firstName:=c.PostForm("first_name")
lastName:=c.DefaultPostForm("last_name", "defaut_last_name")
c.String(http.StatusOK, "%s,%s", firstName, lastName)
})
r.POST("/test", func(c *gin.Context) {
firstName:=c.PostForm("first_name")
lastName:=c.DefaultPostForm("last_name", "defaut_last_name")
c.String(http.StatusOK, "%s,%s", firstName, lastName)
})
2019-11-04
validator已经有了v9.以下v8的写法
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
v.RegisterValidation("bookabledate", bookableDate)
}
须替换为:validate := validator.New();validate.RegisterValidation("bookabledate", bookableDate)
原customFunc传参已更新:func customFunc(fl validator.FieldLevel) bool {}
if v, ok := binding.Validator.Engine().(*validator.Validate); ok {
v.RegisterValidation("bookabledate", bookableDate)
}
须替换为:validate := validator.New();validate.RegisterValidation("bookabledate", bookableDate)
原customFunc传参已更新:func customFunc(fl validator.FieldLevel) bool {}
2019-10-29
已采纳回答 / 牛儿吃草
这个目录结构没有具体要求的,我之前写过一详细介绍:https://blog.csdn.net/e421083458/article/details/89762113
2019-10-04