Documentation
¶
Index ¶
- Variables
- type App
- func (app *App) DefaultLogger() util.Logger
- func (app *App) Get(key string) interface{}
- func (app *App) GetConfig() *cfg.AppConfig
- func (app *App) GetHook(ht HookType) *[]HookFunc
- func (app *App) Initialize()
- func (app *App) Inject(object interface{}) error
- func (app *App) LoadConfig(mode string) *cfg.AppConfig
- func (app *App) Logger(name string) (util.Logger, error)
- func (app *App) RegisterHook(ht HookType, hooks ...HookFunc)
- func (app *App) Set(key string, object interface{}, ifacePtr interface{})
- func (app *App) SetConfig(config *cfg.AppConfig)
- func (app *App) SetLogger(name string, logger util.Logger)
- type Application
- type GrpcApp
- type GrpcApplication
- type HookFunc
- type HookType
- type WebApp
- type WebApplication
Constants ¶
This section is empty.
Variables ¶
var ( // AppMode is App's running envirenment. Valid values are dev and prod AppMode string // ConfigFile is the absolute path of config file ConfigFile string // LogPath is where log file will be LogPath string )
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Store *container.Map
Injector container.Injector
//loggers map[string]util.Logger
Config *cfg.AppConfig
// contains filtered or unexported fields
}
App represents the application
func (*App) DefaultLogger ¶
DefaultLogger gets default logger
func (*App) Inject ¶
Inject dependencies to the object. Please MAKE SURE that the dependencies should be stored at app.Injector before this method is called. Please use app.Set() to make this happen.
func (*App) LoadConfig ¶
LoadConfig by mode from file
func (*App) RegisterHook ¶
RegisterHook in application's starting process
type Application ¶
type Application interface {
// Container
Set(key string, object interface{}, ifacePtr interface{})
Get(key string) interface{}
Inject(object interface{}) error
// hook
GetHook(HookType) *[]HookFunc
// load from file
LoadConfig(mode string) *cfg.AppConfig
SetConfig(*cfg.AppConfig)
GetConfig() *cfg.AppConfig
// logger
DefaultLogger() util.Logger
Logger(name string) (util.Logger, error)
SetLogger(string, util.Logger)
// init
Initialize()
RegisterHook(HookType, ...HookFunc)
}
Application interface represents a service application
type GrpcApp ¶
type GrpcApp struct {
App
// contains filtered or unexported fields
}
GrpcApp is the concrete type of GrpcApplication
func (*GrpcApp) ListenAndServe ¶
func (app *GrpcApp) ListenAndServe()
ListenAndServe implements the GrpcApplication interface
type GrpcApplication ¶
type GrpcApplication interface {
Application
SetServer(*grpc.Server)
GetServer() *grpc.Server
ListenAndServe()
}
GrpcApplication represents a gRPC Application
type WebApp ¶
WebApp is the concrete type of WebApplication
func (*WebApp) ListenAndServe ¶
func (app *WebApp) ListenAndServe()
ListenAndServe the web application
type WebApplication ¶
type WebApplication interface {
Application
GetRouter() *echo.Echo
SetRouter(*echo.Echo)
ListenAndServe()
}
WebApplication interface represents a web application