Back to godoc.org
github.com/TingYunAPM/go/framework/gin

Package tingyun_gin

v0.0.0-...-5e6374a
Latest Go to latest

The highest tagged major version is .

Published: Feb 12, 2020 | License: Apache-2.0 | Module: github.com/TingYunAPM/go/framework/gin

Overview

gin's wrapper

Index

Examples

func FindAction

func FindAction(c *gin.Context) *tingyun.Action

通过一个wrap过的gin.Context 获取这个Context对应的Action

type WrapEngine

type WrapEngine struct {
	WrapGroup
	// contains filtered or unexported fields
}

Wrap gin.Engine

func Default

func Default() *WrapEngine
Example

Code:

tingyun.AppInit("tingyun.json") //初始化tingyun探针
defer tingyun.AppStop()         //退出时关闭探针
r := tingyun_gin.Default()      //这里替换掉原来的gin.Default
r.GET("/ping", func(c *gin.Context) {
	component := tingyun_gin.FindAction(c).CreateComponent("gin.Context::JSON")
	c.JSON(200, gin.H{
		"message": "pong",
	})
	component.Finish()
})
r.Run(":8000")

func New

func New() *WrapEngine
Example

Code:

tingyun.AppInit("tingyun.json") //初始化tingyun探针
defer tingyun.AppStop()         //退出时关闭探针
r := tingyun_gin.New()          //这里替换掉原来的gin.New
r.GET("/ping", func(c *gin.Context) {
	component := tingyun_gin.FindAction(c).CreateComponent("gin.Context::JSON")
	c.JSON(200, gin.H{
		"message": "pong",
	})
	component.Finish()
})
r.Run(":8000")

func (*WrapEngine) Delims

func (e *WrapEngine) Delims(left, right string) *WrapEngine

///////////////////////////////////////////////////////////////////////////

func (*WrapEngine) HandleContext

func (e *WrapEngine) HandleContext(c *gin.Context)

func (*WrapEngine) LoadHTMLFiles

func (e *WrapEngine) LoadHTMLFiles(files ...string)

func (*WrapEngine) LoadHTMLGlob

func (e *WrapEngine) LoadHTMLGlob(pattern string)

func (*WrapEngine) NoMethod

func (e *WrapEngine) NoMethod(handlers ...gin.HandlerFunc)

func (*WrapEngine) NoRoute

func (e *WrapEngine) NoRoute(handlers ...gin.HandlerFunc)

func (*WrapEngine) Routes

func (e *WrapEngine) Routes() gin.RoutesInfo

func (*WrapEngine) Run

func (e *WrapEngine) Run(addr ...string) error

func (*WrapEngine) RunTLS

func (e *WrapEngine) RunTLS(addr string, certFile string, keyFile string) error

func (*WrapEngine) RunUnix

func (e *WrapEngine) RunUnix(file string) error

func (*WrapEngine) SecureJsonPrefix

func (e *WrapEngine) SecureJsonPrefix(prefix string) *WrapEngine

func (*WrapEngine) ServeHTTP

func (e *WrapEngine) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*WrapEngine) SetFuncMap

func (e *WrapEngine) SetFuncMap(funcMap template.FuncMap)

func (*WrapEngine) SetHTMLTemplate

func (e *WrapEngine) SetHTMLTemplate(templ *template.Template)

func (*WrapEngine) TingYunGinEngine

func (e *WrapEngine) TingYunGinEngine() *gin.Engine

func (*WrapEngine) Use

func (e *WrapEngine) Use(middleware ...gin.HandlerFunc) gin.IRoutes

type WrapGroup

type WrapGroup struct {
	// contains filtered or unexported fields
}

Wrap gin.RouterGroup

func (*WrapGroup) Any

func (g *WrapGroup) Any(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) BasePath

func (g *WrapGroup) BasePath() string

func (*WrapGroup) DELETE

func (g *WrapGroup) DELETE(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) GET

func (g *WrapGroup) GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) Group

func (g *WrapGroup) Group(relativePath string, handlers ...gin.HandlerFunc) *WrapGroup

func (*WrapGroup) HEAD

func (g *WrapGroup) HEAD(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) Handle

func (g *WrapGroup) Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) OPTIONS

func (g *WrapGroup) OPTIONS(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) PATCH

func (g *WrapGroup) PATCH(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) POST

func (g *WrapGroup) POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) PUT

func (g *WrapGroup) PUT(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes

func (*WrapGroup) Static

func (g *WrapGroup) Static(relativePath, root string) gin.IRoutes

func (*WrapGroup) StaticFS

func (g *WrapGroup) StaticFS(relativePath string, fs http.FileSystem) gin.IRoutes

func (*WrapGroup) StaticFile

func (g *WrapGroup) StaticFile(relativePath, filepath string) gin.IRoutes

func (*WrapGroup) TingYunGinRouterGroup

func (g *WrapGroup) TingYunGinRouterGroup() *gin.RouterGroup

func (*WrapGroup) Use

func (g *WrapGroup) Use(middleware ...gin.HandlerFunc) gin.IRoutes

/////////////////////////////////////////////////////////////////////////////

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier