Documentation ¶
Index ¶
- Variables
- func GetConfReader() *viper.Viper
- func LoadApplicationConfigFile(options []viper.Option) *viper.Viper
- type App
- func (a *App) Banner(banner string) *App
- func (a *App) ExitDelay(time time.Duration) *App
- func (a *App) Interceptor(interceptor ...mvc.MethodInterceptor) *App
- func (a *App) PostStop(f func()) *App
- func (a *App) PreApply(f func()) *App
- func (a *App) PreStart(f func()) *App
- func (a *App) PreStop(f func()) *App
- func (a *App) ReadConfig(v interface{}) *App
- func (a *App) Run(interceptors ...mvc.MethodInterceptor)
Constants ¶
This section is empty.
Variables ¶
var Env = &config{}
Functions ¶
func GetConfReader ¶ added in v2.1.5
GetConfReader Get config reader of the application
Types ¶
type App ¶
type App struct { Interceptors []mvc.MethodInterceptor // contains filtered or unexported fields }
App application instance
func Default ¶
Default Create a default application with log printing, exception interception, and cross-domain middleware
func New ¶
func New(confReaderOptions []viper.Option, middlewares ...gin.HandlerFunc) *App
New Create a clean application, you can add some gin middlewares to the engine
func (*App) ExitDelay ¶ added in v2.2.0
ExitDelay Graceful exit time(default 3s), when reached to shut down the server and trigger PostStop().
func (*App) Interceptor ¶ added in v2.2.2
func (a *App) Interceptor(interceptor ...mvc.MethodInterceptor) *App
Interceptor Add a global interceptor
func (*App) PostStop ¶ added in v2.2.0
PostStop Events after the application has stopped can perform other closing operations here
func (*App) PreApply ¶ added in v2.2.0
PreApply triggered before mvc starts, Before the project starts. This is where you can provide basic services, such as set beans. Of course, you can also perform logic here that doesn't require obtaining beans.
func (*App) PreStart ¶ added in v2.2.0
PreStart The last event before the project starts, dependency injection is all finished and ready to run. You can execute any logic here.
func (*App) PreStop ¶ added in v2.2.0
PreStop The event before the application stops can be performed here to close some resources
func (*App) ReadConfig ¶
ReadConfig Read configuration v config struct pointer
func (*App) Run ¶
func (a *App) Run(interceptors ...mvc.MethodInterceptor)
Run the main program entry interceptors: link{mvc.MethodInterceptor}