Documentation
¶
Overview ¶
Package app 核心功能的实现
Index ¶
- func AddCompress(name string, f compress.WriterFunc) error
- func SetCompress(name string, f compress.WriterFunc)
- type App
- func (app *App) Close() error
- func (app *App) Debug() bool
- func (app *App) Handler() (http.Handler, error)
- func (app *App) InitModules(tag string) error
- func (app *App) Modules() []*module.Module
- func (app *App) Mux() *mux.Mux
- func (app *App) NewModule(name, desc string, deps ...string) *module.Module
- func (app *App) RegisterOnShutdown(f func())
- func (app *App) Serve() error
- func (app *App) SetMiddlewares(m ...middleware.Middleware) *App
- func (app *App) Shutdown() error
- func (app *App) URL(path string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCompress ¶ added in v0.17.0
func AddCompress(name string, f compress.WriterFunc) error
AddCompress 添加压缩方法。框架本身已经指定了 gzip 和 deflate 两种方法。
func SetCompress ¶ added in v0.17.0
func SetCompress(name string, f compress.WriterFunc)
SetCompress 修改或是添加压缩方法。
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App 程序运行实例
func (*App) InitModules ¶ added in v0.16.1
InitModules 执行模板的初始化函数。可以重复调用执行。
func (*App) RegisterOnShutdown ¶ added in v0.16.1
func (app *App) RegisterOnShutdown(f func())
RegisterOnShutdown 等于于 http.Server.RegisterOnShutdown
func (*App) SetMiddlewares ¶ added in v0.17.0
func (app *App) SetMiddlewares(m ...middleware.Middleware) *App
SetMiddlewares 设置一个全局的中间件,多次设置,只有最后一次会启作用。
Click to show internal directories.
Click to hide internal directories.