Documentation ¶
Index ¶
Constants ¶
const Version = "1.0.0-beta4"
Version is exported for runtime compatibility checks
Variables ¶
var ( // DefaultStartTimeout will be used to start app in Run DefaultStartTimeout = 15 * time.Second // DefaultStopTimeout will be used to stop app in Run DefaultStopTimeout = 5 * time.Second )
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App models a modular application
func (*App) Provide ¶
func (s *App) Provide(constructors ...interface{})
Provide constructors into the D.I. Container, their types will be available to all other constructors, and called lazily at startup
func (*App) Run ¶
func (s *App) Run(funcs ...interface{})
Run starts the app, blocks for SIGINT or SIGTERM, then gracefully stops
type Hook ¶
type Hook struct { OnStart func() error OnStop func() error // contains filtered or unexported fields }
Hook is a pair of Start and Stop funcs that get executed as part of Lifecycle start and stop.
type Lifecycle ¶
type Lifecycle interface {
Append(Hook)
}
Lifecycle enables appending Events, OnStart and OnStop func pairs, to be executed on Service start and stop
type TestLifecycle ¶
type TestLifecycle struct {
// contains filtered or unexported fields
}
TestLifecycle makes testing funcs that rely on Lifecycle possible be exposing a Start and Stop func which can be called manually in the context of a unit test.
func NewTestLifecycle ¶
func NewTestLifecycle() *TestLifecycle
NewTestLifecycle creates a new test lifecycle