Documentation
¶
Overview ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GinDefaultZap ¶
func GinDefaultZap() gin.HandlerFunc
func GinZap ¶
func GinZap(timeFormat string, utc bool) gin.HandlerFunc
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 RecoveryWithZap ¶
func RecoveryWithZap(stack bool) gin.HandlerFunc
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.
Types ¶
type BaseIController ¶
func (*BaseIController) Init ¶
func (b *BaseIController) Init()
func (*BaseIController) PreInit ¶
func (b *BaseIController) PreInit(app cherryInterfaces.IApplication, engine *gin.Engine)
func (*BaseIController) Stop ¶
func (b *BaseIController) Stop()
type GinComponent ¶
type GinComponent struct {
cherryInterfaces.BaseComponent
// contains filtered or unexported fields
}
func New ¶
func New(address string) *GinComponent
func NewHttp ¶
func NewHttp(name, address string) *GinComponent
func NewHttps ¶
func NewHttps(name, address, certFile, keyFile string) *GinComponent
func NewWithOptions ¶
func NewWithOptions(name string, options GinComponentOptions) *GinComponent
func (*GinComponent) AfterInit ¶
func (g *GinComponent) AfterInit()
func (*GinComponent) BeforeStop ¶
func (g *GinComponent) BeforeStop()
func (*GinComponent) GetEngine ¶
func (g *GinComponent) GetEngine() *gin.Engine
func (*GinComponent) Init ¶
func (g *GinComponent) Init()
func (*GinComponent) Register ¶
func (g *GinComponent) Register(controller IController)
func (*GinComponent) Stop ¶
func (g *GinComponent) Stop()
type GinComponentOptions ¶
type IController ¶
Click to show internal directories.
Click to hide internal directories.