上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页
摘要: package main import ( "fmt" "github.com/gin-gonic/gin" ) func main() { router := gin.Default() router.GET("/cookie", func(context *gin.Context) { // 获 阅读全文
posted @ 2021-10-28 14:50 专职 阅读(533) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/go-playground/validator/v10" "net/http" "time" ) type 阅读全文
posted @ 2021-10-28 14:23 专职 阅读(367) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "log" "time" ) func Logger() gin.HandlerFunc { return func(context *gin.Context) { t := time.Now() // 阅读全文
posted @ 2021-10-28 10:28 专职 阅读(51) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "net/http" "time" ) func main() { // 自定义http配置1 //router := gin.Default() //router.GET("/", func(cont 阅读全文
posted @ 2021-10-28 09:53 专职 阅读(215) 评论(0) 推荐(0) 编辑
摘要: package main import "github.com/gin-gonic/gin" type StructA struct { FieldA string `form:"field_a"` } type StructB struct { // 嵌套结构体 NestedStruct Stru 阅读全文
posted @ 2021-10-27 18:18 专职 阅读(381) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "log" "time" ) type Person struct { Name string `form:"name"` Address string `form:"address"` Birthda 阅读全文
posted @ 2021-10-27 16:55 专职 阅读(21) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "net/http" ) type Person struct { Id string `uri:"id" binding:"required,uuid"` Name string `uri:"name 阅读全文
posted @ 2021-10-27 16:33 专职 阅读(111) 评论(0) 推荐(0) 编辑
摘要: main.go package main import "github.com/gin-gonic/gin" type myForm struct { Colors []string `form:"colors[]"` } func main() { r := gin.Default() r.Loa 阅读全文
posted @ 2021-10-27 16:03 专职 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 要将请求体绑定到结构体中,使用模型绑定。 Gin目前支持JSON、XML、YAML和标准表单值的绑定(foo=bar&boo=baz)。 Gin使用 go-playground/validator/v10 进行验证。 查看标签用法的全部文档. 使用时,需要在要绑定的所有字段上,设置相应的tag。 例 阅读全文
posted @ 2021-10-27 15:36 专职 阅读(259) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { r := gin.Default() r.GET("/", func(context *gin.Context) { id := context.Q 阅读全文
posted @ 2021-10-27 14:55 专职 阅读(168) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页