Documentation ¶
Index ¶
- type App
- func (a *App) AddTask(task Tasker) error
- func (a *App) BackgroundContext() context.Context
- func (a *App) Cache() *cache.Cache
- func (a *App) Config() *config.Configuration
- func (a *App) Env() Environment
- func (a *App) HTTPClient(name ...string) (http.Client, error)
- func (a *App) Instrumentation(instr instrumenter.Instrumenter)
- func (a *App) Instrumenter() instrumenter.Instrumenter
- func (a *App) Log() *zap.Logger
- func (a *App) ReplaceLogger(logger *zap.Logger) error
- func (a *App) SetConfig(_ *cobra.Command, conf *config.Configuration)
- func (a *App) SetVersion(version, builtWith string)
- func (a *App) Start() error
- func (a *App) Stop()
- func (a *App) String() string
- func (a *App) Validate() *validation.Validate
- type Environment
- type Tasker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { // App settings AppVer string AppBuiltWith string AppName string // contains filtered or unexported fields }
func (*App) AddTask ¶ added in v0.6.0
AddTask adds task to the app.
If app is already started, task is started immediately.
func (*App) BackgroundContext ¶
BackgroundContext returns global background context.
func (*App) Config ¶
func (a *App) Config() *config.Configuration
Config returns application configuration.
Panics if configuration is not loaded.
func (*App) HTTPClient ¶ added in v0.15.0
func (*App) Instrumentation ¶ added in v0.7.0
func (a *App) Instrumentation(instr instrumenter.Instrumenter)
Instrumentation defines callback to be used as instrumenter.
func (*App) Instrumenter ¶ added in v0.7.0
func (a *App) Instrumenter() instrumenter.Instrumenter
Instrumenter returns application instrumentation callback.
func (*App) ReplaceLogger ¶ added in v0.3.0
ReplaceLogger replaces current application logger with custom.
Default fields are automatically added to the logger.
func (*App) SetConfig ¶
func (a *App) SetConfig(_ *cobra.Command, conf *config.Configuration)
SetConfig binds application configuration to the application.
func (*App) SetVersion ¶
SetVersion sets application version and built with tags.
func (*App) Validate ¶
func (a *App) Validate() *validation.Validate
Validate returns validation service instance.
type Environment ¶
type Environment string
Environment type.
const ( EnvironmentDevelopment Environment = "Development" EnvironmentStaging Environment = "Staging" EnvironmentProduction Environment = "Production" )
func NewEnvironment ¶
func NewEnvironment(defaultMode Environment) Environment
NewEnvironment creates new Environment instance.
func (Environment) IsDevelopment ¶
func (e Environment) IsDevelopment() bool
IsDevelopment checks if current environment is development.
func (Environment) IsProduction ¶
func (e Environment) IsProduction() bool
IsProduction checks if current environment is production.
func (Environment) IsStaging ¶
func (e Environment) IsStaging() bool
IsStaging checks if current environment is staging.