chore: add some annotations (#1550)

ref #1075 should all annotations and can close #1075 .
This commit is contained in:
田欧
2018-09-15 15:21:54 +08:00
committed by Bo-Yi Wu
parent d510595aa5
commit 6db092f778
7 changed files with 47 additions and 12 deletions

6
gin.go
View File

@ -26,7 +26,10 @@ var (
defaultAppEngine bool
)
// HandlerFunc defines the handler used by gin middleware as return value.
type HandlerFunc func(*Context)
// HandlersChain defines a HandlerFunc array.
type HandlersChain []HandlerFunc
// Last returns the last handler in the chain. ie. the last handler is the main own.
@ -37,12 +40,14 @@ func (c HandlersChain) Last() HandlerFunc {
return nil
}
// RouteInfo represents a request route's specification which contains method and path and its handler.
type RouteInfo struct {
Method string
Path string
Handler string
}
// RoutesInfo defines a RouteInfo array.
type RoutesInfo []RouteInfo
// Engine is the framework's instance, it contains the muxer, middleware and configuration settings.
@ -155,6 +160,7 @@ func (engine *Engine) allocateContext() *Context {
return &Context{engine: engine}
}
// Delims sets template left and right delims and returns a Engine instance.
func (engine *Engine) Delims(left, right string) *Engine {
engine.delims = render.Delims{Left: left, Right: right}
return engine