4 Star 0 Fork 0

广州比力信息技术有限公司 / go_gin_swagger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
example.go 564 Bytes
一键复制 编辑 原始数据 按行查看 历史
mouse 提交于 2023-02-10 14:12 . fix
package v2
import (
"github.com/gin-gonic/gin"
)
type Book struct {
ID int `json:"id,omitempty"`
Title string `json:"title"`
Author string `json:"author"`
Year *uint16 `json:"year"`
}
//
// @Summary Get a list of books in the the store
// @Description get string by ID
// @Accept json
// @Produce json
// @Success 200 {array} Book "ok"
// @Router /books [get]
func GetBooks(ctx *gin.Context) {
ctx.JSON(200, []Book{
{ID: 1, Title: "Book 3", Author: "Author 3", Year: nil},
{ID: 2, Title: "Book 4", Author: "Author 4", Year: nil},
})
}
1
https://gitee.com/infobili/gin-swagger.git
git@gitee.com:infobili/gin-swagger.git
infobili
gin-swagger
go_gin_swagger
198b4e5e46f1

搜索帮助