Documentation ¶
Index ¶
- Constants
- type Application
- func (app *Application) Boot() error
- func (app *Application) BootstrapWith(boostrappers ...Bootstrapper) error
- func (app *Application) Commands(commands ...ConsoleCommand)
- func (app *Application) Config() *ConfigRepository
- func (app *Application) Env(name string) bool
- func (app *Application) Facade(wrappers ...*Facade)
- func (app *Application) GetCommands() []ConsoleCommand
- func (app *Application) ImportConfig() *Application
- func (app *Application) Register(providers ...ServiceProvider)
- func (app *Application) ResolveTag(tag string, container *container.Container) interface{}
- func (app *Application) Run()
- func (app *Application) SetConfig(loader ConfigLoader) *Application
- type Bootstrapper
- type Config
- type ConfigLoader
- type ConfigRepository
- type ConsoleCommand
- type ExitHandler
- type Facade
- type Kernel
- type ServiceProvider
- type SignalsHandler
Constants ¶
const ( // HomeDirectory default path to application home directory. HomeDirectory = "/var/lib/larago" // DateTimeFormat default date-time format. DateTimeFormat = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { *container.Container Version string Name string Description string HomeDirectory string DateTimeFormat string // contains filtered or unexported fields }
Application struct.
func (*Application) BootstrapWith ¶
func (app *Application) BootstrapWith(boostrappers ...Bootstrapper) error
BootstrapWith runs bootstrappers one by one to populate and prepare application.
func (*Application) Commands ¶
func (app *Application) Commands(commands ...ConsoleCommand)
Commands registers commands.
func (*Application) Env ¶
func (app *Application) Env(name string) bool
Env checks if application works in this environment.
func (*Application) Facade ¶
func (app *Application) Facade(wrappers ...*Facade)
Facade registers application facades.
func (*Application) GetCommands ¶
func (app *Application) GetCommands() []ConsoleCommand
GetCommands retrieve registered console commands.
func (*Application) ImportConfig ¶
func (app *Application) ImportConfig() *Application
ImportConfig of the application.
func (*Application) Register ¶
func (app *Application) Register(providers ...ServiceProvider)
Register service.
func (*Application) ResolveTag ¶
func (app *Application) ResolveTag(tag string, container *container.Container) interface{}
ResolveTag resolves custom tags.
func (*Application) SetConfig ¶
func (app *Application) SetConfig(loader ConfigLoader) *Application
SetConfig callback that loads config while bootstrapping.
type Config ¶
type Config interface { // Env returns current environment name. Env() string // Debug returs debug mode state. Debug() bool }
Config interface.
type ConfigLoader ¶
type ConfigLoader func() Config
ConfigLoader is a callback function for lazy loading application config.
type ConfigRepository ¶
type ConfigRepository struct {
// contains filtered or unexported fields
}
ConfigRepository used to store and get access to application config vars.
func (*ConfigRepository) Debug ¶
func (c *ConfigRepository) Debug() bool
Debug returs debug mode state.
func (*ConfigRepository) Env ¶
func (c *ConfigRepository) Env() string
Env returns current environment name.
func (*ConfigRepository) Get ¶
func (c *ConfigRepository) Get(key string) interface{}
Get value from config using dot-notation.
func (*ConfigRepository) Set ¶
func (c *ConfigRepository) Set(key string, value interface{})
Set value to config using dot-notation.
type ConsoleCommand ¶
type ConsoleCommand interface { // GetCommand for the cli to register. GetCommand() cli.Command // Handle command. Handle(args cli.Args) error }
ConsoleCommand interface.
type ExitHandler ¶
type ExitHandler interface { // Exit application gracefully with message and code. Exit(message string, exitCode int) // Defer handles panics. Defer() }
ExitHandler provides interface to handle application exits and panic throws.
type Facade ¶
type Facade struct { Application *Application // contains filtered or unexported fields }
Facade struct.
type Kernel ¶
type Kernel interface { // Handle console command. Handle() // SetBootstrappers sets Application bootstrappers. SetBootstrappers(bootstrappers ...Bootstrapper) }
Kernel interface.
type ServiceProvider ¶
type ServiceProvider interface { // Register service. Register(application *Application) }
ServiceProvider interface.
type SignalsHandler ¶
type SignalsHandler interface {
// CatchInterrupt handles sigterm.
CatchInterrupt()
}
SignalsHandler provides interface to handle system signals.