Documentation ¶
Overview ¶
Package ginhelper brings convenience to development with gin.
Automatically generate swagger documents without comments.
Index ¶
Examples ¶
Constants ¶
View Source
const ( MethodGet = "GET" MethodPost = "POST" MethodPut = "PUT" MethodPatch = "PATCH" MethodHead = "HEAD" MethodOptions = "OPTIONS" MethodDelete = "DELETE" MethodAny = "ANY" )
Variables ¶
View Source
var GenHandlerFunc gin.HandlerFunc = nil
Functions ¶
Types ¶
type ContactInfoProps ¶
type ContactInfoProps spec.ContactInfoProps
type GinRouter ¶
type GinRouter interface { gin.IRoutes Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup BasePath() string }
type GroupRouter ¶
type Helper ¶
type Helper struct { Swagger *Swagger // contains filtered or unexported fields }
func NewWithSwagger ¶
func NewWithSwagger(swaggerInfo *SwaggerInfo, r GinRouter) *Helper
Example ¶
router := gin.Default() r := router.Group("api") h := NewWithSwagger(&SwaggerInfo{ Description: "swagger test page", Title: "Swagger Test Page", Version: "0.0.1", AuthHeaderKey: "Authorization", ContactInfoProps: ContactInfoProps{ Name: "zzj", URL: "https://zzj.cool", Email: "email@zzj.cool", }, }, r) h.Add(exGroup, r) _ = router.Run(":12321")
Output:
func (*Helper) Add ¶
func (h *Helper) Add(gh *GroupRouter, r GinRouter)
type Route ¶
type Route struct { Param Parameter // 接口的参数 Path string // 接口的路径 Method string // 接口的方法 Summary string // 接口说明 Handlers []gin.HandlerFunc // 接口的处理函数 }
func (*Route) AddHandler ¶
type Swagger ¶
type Swagger struct { BasePath string Router GinRouter *SwaggerInfo Spec *spec.Swagger }
func (*Swagger) AddPath ¶
func (s *Swagger) AddPath(sp *SwaggerApi)
type SwaggerApi ¶
type SwaggerInfo ¶
type SwaggerInfo struct { Description string Title string Version string AuthHeaderKey string ContactInfoProps }
Click to show internal directories.
Click to hide internal directories.