lifecycle

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Earliest = di.Earliest
	Earlier  = di.Earlier
	Normal   = di.Normal
	Later    = di.Later
	Latest   = di.Latest
)

Variables

View Source
var StartersGroupName = "lifecycle.starters"
View Source
var StoppersGroupName = "lifecycle.stoppers"

Functions

func AppendStarters

func AppendStarters(lc fx.Lifecycle, starters ...Starter)

func AppendStoppers

func AppendStoppers(lc fx.Lifecycle, stoppers ...Stopper)

func Module

func Module() di.Node

func NewBackgroundContext

func NewBackgroundContext() context.Context

func StartPriority added in v1.12.1

func StartPriority(value PriorityLevel) di.Option

StartPriority controls lifecycle starter registration order. Lower values register earlier. Stable order is preserved for ties.

func StopPriority added in v1.12.1

func StopPriority(value PriorityLevel) di.Option

StopPriority controls lifecycle stopper registration order. Lower values register earlier. Stable order is preserved for ties.

Types

type MockStarter added in v1.2.0

type MockStarter struct {
	mock.Mock
}

MockStarter is an autogenerated mock type for the Starter type

func NewMockStarter added in v1.2.0

func NewMockStarter(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockStarter

NewMockStarter creates a new instance of MockStarter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockStarter) EXPECT added in v1.2.0

func (_m *MockStarter) EXPECT() *MockStarter_Expecter

func (*MockStarter) Start added in v1.2.0

func (_mock *MockStarter) Start(ctx context.Context) error

Start provides a mock function for the type MockStarter

type MockStarter_Expecter added in v1.2.0

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

func (*MockStarter_Expecter) Start added in v1.2.0

func (_e *MockStarter_Expecter) Start(ctx interface{}) *MockStarter_Start_Call

Start is a helper method to define mock.On call

  • ctx context.Context

type MockStarter_Start_Call added in v1.2.0

type MockStarter_Start_Call struct {
	*mock.Call
}

MockStarter_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'

func (*MockStarter_Start_Call) Return added in v1.2.0

func (*MockStarter_Start_Call) Run added in v1.2.0

func (*MockStarter_Start_Call) RunAndReturn added in v1.2.0

func (_c *MockStarter_Start_Call) RunAndReturn(run func(ctx context.Context) error) *MockStarter_Start_Call

type MockStopper added in v1.2.0

type MockStopper struct {
	mock.Mock
}

MockStopper is an autogenerated mock type for the Stopper type

func NewMockStopper added in v1.2.0

func NewMockStopper(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockStopper

NewMockStopper creates a new instance of MockStopper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockStopper) EXPECT added in v1.2.0

func (_m *MockStopper) EXPECT() *MockStopper_Expecter

func (*MockStopper) Stop added in v1.2.0

func (_mock *MockStopper) Stop(ctx context.Context) error

Stop provides a mock function for the type MockStopper

type MockStopper_Expecter added in v1.2.0

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

func (*MockStopper_Expecter) Stop added in v1.2.0

func (_e *MockStopper_Expecter) Stop(ctx interface{}) *MockStopper_Stop_Call

Stop is a helper method to define mock.On call

  • ctx context.Context

type MockStopper_Stop_Call added in v1.2.0

type MockStopper_Stop_Call struct {
	*mock.Call
}

MockStopper_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'

func (*MockStopper_Stop_Call) Return added in v1.2.0

func (*MockStopper_Stop_Call) Run added in v1.2.0

func (*MockStopper_Stop_Call) RunAndReturn added in v1.2.0

func (_c *MockStopper_Stop_Call) RunAndReturn(run func(ctx context.Context) error) *MockStopper_Stop_Call

type PriorityLevel added in v1.12.1

type PriorityLevel = di.PriorityLevel

type Starter

type Starter interface {
	Start(ctx context.Context) error
}

type Stopper

type Stopper interface {
	Stop(ctx context.Context) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL