fx: go.uber.org/fx/internal/lifecycle Index | Files

package lifecycle

import "go.uber.org/fx/internal/lifecycle"

Index

Package Files

lifecycle.go

type Hook Uses

type Hook struct {
    OnStart func(context.Context) error
    OnStop  func(context.Context) error
    // contains filtered or unexported fields
}

A Hook is a pair of start and stop callbacks, either of which can be nil, plus a string identifying the supplier of the hook.

type Lifecycle Uses

type Lifecycle struct {
    // contains filtered or unexported fields
}

Lifecycle coordinates application lifecycle hooks.

func New Uses

func New(logger *fxlog.Logger) *Lifecycle

New constructs a new Lifecycle.

func (*Lifecycle) Append Uses

func (l *Lifecycle) Append(hook Hook)

Append adds a Hook to the lifecycle.

func (*Lifecycle) Start Uses

func (l *Lifecycle) Start(ctx context.Context) error

Start runs all OnStart hooks, returning immediately if it encounters an error.

func (*Lifecycle) Stop Uses

func (l *Lifecycle) Stop(ctx context.Context) error

Stop runs any OnStop hooks whose OnStart counterpart succeeded. OnStop hooks run in reverse order.

Package lifecycle imports 4 packages (graph) and is imported by 3 packages. Updated 2019-01-15. Refresh now. Tools for package owners.