Documentation
¶
Overview ¶
Package cherryGin from https://github.com/gin-contrib/zap/
Index ¶
- func BindHandler(handler func(ctx *Context)) gin.HandlerFunc
- func BindHandlers(handlers []GinHandlerFunc) []gin.HandlerFunc
- func SetMode(value string)
- type BaseController
- func (b *BaseController) Any(relativePath string, handlers ...GinHandlerFunc)
- func (b *BaseController) GET(relativePath string, handlers ...GinHandlerFunc)
- func (b *BaseController) Group(relativePath string, handlers ...GinHandlerFunc) *Group
- func (b *BaseController) Init()
- func (b *BaseController) POST(relativePath string, handlers ...GinHandlerFunc)
- func (b *BaseController) PreInit(app cherryFacade.IApplication, engine *gin.Engine)
- func (b *BaseController) Stop()
- type Component
- func (g *Component) Init()
- func (g *Component) Name() string
- func (g *Component) OnAfterInit()
- func (g *Component) OnBeforeStop()
- func (g *Component) OnStop()
- func (g *Component) Register(controllers ...IController) *Component
- func (g *Component) StaticFS(relativePath string, staticDir string)
- func (g *Component) StaticFile(relativePath string, staticDir string)
- func (g *Component) Use(middleware ...GinHandlerFunc)
- type Context
- func (g *Context) GetBody() string
- func (g *Context) GetBool(name string, defaultValue bool, checkPost ...bool) bool
- func (g *Context) GetInt(name string, defaultValue int, checkPost ...bool) int
- func (g *Context) GetInt32(name string, defaultValue int32, checkPost ...bool) int32
- func (g *Context) GetInt64(name string, defaultValue int64, checkPost ...bool) int64
- func (g *Context) GetParams(checkPost ...bool) map[string]string
- func (g *Context) GetString(name, defaultValue string, checkPost ...bool) string
- func (g *Context) PostInt(name string, defaultValue int) int
- func (g *Context) PostInt64(name string, defaultValue int64) int64
- func (g *Context) PostString(name string, defaultValue string) string
- func (g *Context) RenderDataResult(code int32, data ...interface{})
- func (g *Context) RenderHTML(html string)
- func (g *Context) RenderJSON(value interface{})
- func (g *Context) RenderJsonString(json string)
- type GinHandlerFunc
- type Group
- type HttpServer
- func (p *HttpServer) LoadHTMLGlob(pattern string)
- func (p *HttpServer) Register(controllers ...IController) *HttpServer
- func (p *HttpServer) Run()
- func (p *HttpServer) SetIApplication(app cherryFacade.IApplication)
- func (p *HttpServer) Static(relativePath string, staticDir string)
- func (p *HttpServer) StaticFS(relativePath string, staticDir string)
- func (p *HttpServer) StaticFile(relativePath string, staticDir string)
- func (p *HttpServer) Stop()
- func (p *HttpServer) Use(middleware ...GinHandlerFunc)
- type IController
- type OptionFunc
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindHandler ¶ added in v1.1.22
func BindHandler(handler func(ctx *Context)) gin.HandlerFunc
func BindHandlers ¶ added in v1.1.22
func BindHandlers(handlers []GinHandlerFunc) []gin.HandlerFunc
Types ¶
type BaseController ¶ added in v1.1.0
func (*BaseController) Any ¶ added in v1.1.0
func (b *BaseController) Any(relativePath string, handlers ...GinHandlerFunc)
func (*BaseController) GET ¶ added in v1.1.0
func (b *BaseController) GET(relativePath string, handlers ...GinHandlerFunc)
func (*BaseController) Group ¶ added in v1.1.22
func (b *BaseController) Group(relativePath string, handlers ...GinHandlerFunc) *Group
func (*BaseController) Init ¶ added in v1.1.0
func (b *BaseController) Init()
func (*BaseController) POST ¶ added in v1.1.0
func (b *BaseController) POST(relativePath string, handlers ...GinHandlerFunc)
func (*BaseController) PreInit ¶ added in v1.1.0
func (b *BaseController) PreInit(app cherryFacade.IApplication, engine *gin.Engine)
func (*BaseController) Stop ¶ added in v1.1.0
func (b *BaseController) Stop()
type Component ¶ added in v1.1.0
type Component struct {
cherryFacade.Component
// contains filtered or unexported fields
}
Component wrapper gin
func (*Component) OnAfterInit ¶ added in v1.1.0
func (g *Component) OnAfterInit()
func (*Component) OnBeforeStop ¶ added in v1.1.0
func (g *Component) OnBeforeStop()
func (*Component) Register ¶ added in v1.1.0
func (g *Component) Register(controllers ...IController) *Component
func (*Component) StaticFile ¶ added in v1.1.0
func (*Component) Use ¶ added in v1.1.22
func (g *Component) Use(middleware ...GinHandlerFunc)
type Context ¶ added in v1.1.0
func (*Context) PostString ¶ added in v1.1.0
func (g *Context) PostString(name string, defaultValue string) string
func (*Context) RenderDataResult ¶ added in v1.1.21
func (*Context) RenderHTML ¶ added in v1.1.0
func (g *Context) RenderHTML(html string)
func (*Context) RenderJSON ¶ added in v1.1.0
func (g *Context) RenderJSON(value interface{})
func (*Context) RenderJsonString ¶ added in v1.1.21
func (g *Context) RenderJsonString(json string)
type GinHandlerFunc ¶ added in v1.1.22
type GinHandlerFunc func(ctx *Context)
func Cors ¶ added in v1.1.11
func Cors(domain ...string) GinHandlerFunc
func GinDefaultZap ¶
func GinDefaultZap() GinHandlerFunc
func GinZap ¶
func GinZap(timeFormat string, utc bool) GinHandlerFunc
GinZap returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap.
Requests with errors are logged using zap.Error(). Requests without errors are logged using zap.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
func MaxConnect ¶ added in v1.1.22
func MaxConnect(n int) GinHandlerFunc
MaxConnect limit max connect
func RecoveryWithZap ¶
func RecoveryWithZap(stack bool) GinHandlerFunc
RecoveryWithZap returns a gin.HandlerFunc (middleware) that recovers from any panics and logs requests using uber-go/zap. All errors are logged using zap.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large.
type Group ¶ added in v1.1.22
type Group struct {
*gin.RouterGroup
}
func (*Group) Any ¶ added in v1.1.22
func (p *Group) Any(relativePath string, handlers ...GinHandlerFunc)
func (*Group) GET ¶ added in v1.1.22
func (p *Group) GET(relativePath string, handlers ...GinHandlerFunc)
func (*Group) POST ¶ added in v1.1.22
func (p *Group) POST(relativePath string, handlers ...GinHandlerFunc)
type HttpServer ¶ added in v1.1.22
type HttpServer struct {
cherryFacade.IApplication
Options
Engine *gin.Engine
// contains filtered or unexported fields
}
func NewHttpServer ¶ added in v1.1.22
func NewHttpServer(address string, opts ...OptionFunc) *HttpServer
func (*HttpServer) LoadHTMLGlob ¶ added in v1.1.22
func (p *HttpServer) LoadHTMLGlob(pattern string)
func (*HttpServer) Register ¶ added in v1.1.22
func (p *HttpServer) Register(controllers ...IController) *HttpServer
func (*HttpServer) Run ¶ added in v1.1.22
func (p *HttpServer) Run()
func (*HttpServer) SetIApplication ¶ added in v1.1.22
func (p *HttpServer) SetIApplication(app cherryFacade.IApplication)
func (*HttpServer) Static ¶ added in v1.1.22
func (p *HttpServer) Static(relativePath string, staticDir string)
func (*HttpServer) StaticFS ¶ added in v1.1.22
func (p *HttpServer) StaticFS(relativePath string, staticDir string)
func (*HttpServer) StaticFile ¶ added in v1.1.22
func (p *HttpServer) StaticFile(relativePath string, staticDir string)
func (*HttpServer) Stop ¶ added in v1.1.22
func (p *HttpServer) Stop()
func (*HttpServer) Use ¶ added in v1.1.22
func (p *HttpServer) Use(middleware ...GinHandlerFunc)
type IController ¶
type OptionFunc ¶ added in v1.1.22
type OptionFunc func(opts *Options)
func WithCert ¶ added in v1.1.22
func WithCert(certFile, keyFile string) OptionFunc
func WithIdleTimeout ¶ added in v1.1.22
func WithIdleTimeout(t time.Duration) OptionFunc
func WithMaxHeaderBytes ¶ added in v1.1.22
func WithMaxHeaderBytes(val int) OptionFunc
func WithReadHeaderTimeout ¶ added in v1.1.22
func WithReadHeaderTimeout(t time.Duration) OptionFunc
func WithReadTimeout ¶ added in v1.1.22
func WithReadTimeout(t time.Duration) OptionFunc
Click to show internal directories.
Click to hide internal directories.