Documentation
¶
Overview ¶
Package di exposes shared dependency injection helpers for KSail commands.
This package provides a runtime container for registering and resolving dependencies used by Cobra commands, enabling testable and modular command implementations through dependency injection patterns.
Key Components ¶
Runtime: A container that manages dependency registration and lifecycle. Module: A function that registers one or more dependencies with the injector. Injector: The underlying DI container (aliased from samber/do).
Usage ¶
Create a runtime with default dependencies:
runtime := di.NewRuntime()
Use the runtime in a Cobra command:
cmd.RunE = di.RunEWithRuntime(runtime, func(cmd *cobra.Command, injector di.Injector) error {
timer, err := di.ResolveTimer(injector)
// ... use dependencies
})
Or use a decorator to automatically resolve dependencies:
cmd.RunE = di.RunEWithRuntime(runtime, di.WithTimer(
func(cmd *cobra.Command, injector di.Injector, timer timer.Timer) error {
// timer is already resolved
}
))
Testing ¶
In tests, create a runtime with mock dependencies:
mockTimer := timer.NewMockTimer(t)
runtime := di.New(func(i di.Injector) error {
do.Provide(i, func(do.Injector) (timer.Timer, error) {
return mockTimer, nil
})
return nil
})
Index ¶
- func ResolveClusterProvisionerFactory(injector Injector) (clusterprovisioner.Factory, error)
- func ResolveTimer(injector Injector) (timer.Timer, error)
- func RunEWithRuntime(runtimeContainer *Runtime, ...) func(*cobra.Command, []string) error
- func WithTimer(handler func(cmd *cobra.Command, injector Injector, tmr timer.Timer) error) func(cmd *cobra.Command, injector Injector) error
- type Injector
- type MockInjector
- func (_mock *MockInjector) Ancestors() []*do.Scope
- func (_mock *MockInjector) ChildByID(s string) (*do.Scope, bool)
- func (_mock *MockInjector) ChildByName(s string) (*do.Scope, bool)
- func (_mock *MockInjector) Children() []*do.Scope
- func (_m *MockInjector) EXPECT() *MockInjector_Expecter
- func (_mock *MockInjector) HealthCheck() map[string]error
- func (_mock *MockInjector) HealthCheckWithContext(context1 context.Context) map[string]error
- func (_mock *MockInjector) ID() string
- func (_mock *MockInjector) ListInvokedServices() []do.ServiceDescription
- func (_mock *MockInjector) ListProvidedServices() []do.ServiceDescription
- func (_mock *MockInjector) Name() string
- func (_mock *MockInjector) RootScope() *do.RootScope
- func (_mock *MockInjector) Scope(s string, fns ...func(do.Injector)) *do.Scope
- func (_mock *MockInjector) Shutdown() *do.ShutdownReport
- func (_mock *MockInjector) ShutdownWithContext(context1 context.Context) *do.ShutdownReport
- type MockInjector_Ancestors_Call
- type MockInjector_ChildByID_Call
- func (_c *MockInjector_ChildByID_Call) Return(scope *do.Scope, b bool) *MockInjector_ChildByID_Call
- func (_c *MockInjector_ChildByID_Call) Run(run func(s string)) *MockInjector_ChildByID_Call
- func (_c *MockInjector_ChildByID_Call) RunAndReturn(run func(s string) (*do.Scope, bool)) *MockInjector_ChildByID_Call
- type MockInjector_ChildByName_Call
- func (_c *MockInjector_ChildByName_Call) Return(scope *do.Scope, b bool) *MockInjector_ChildByName_Call
- func (_c *MockInjector_ChildByName_Call) Run(run func(s string)) *MockInjector_ChildByName_Call
- func (_c *MockInjector_ChildByName_Call) RunAndReturn(run func(s string) (*do.Scope, bool)) *MockInjector_ChildByName_Call
- type MockInjector_Children_Call
- type MockInjector_Expecter
- func (_e *MockInjector_Expecter) Ancestors() *MockInjector_Ancestors_Call
- func (_e *MockInjector_Expecter) ChildByID(s interface{}) *MockInjector_ChildByID_Call
- func (_e *MockInjector_Expecter) ChildByName(s interface{}) *MockInjector_ChildByName_Call
- func (_e *MockInjector_Expecter) Children() *MockInjector_Children_Call
- func (_e *MockInjector_Expecter) HealthCheck() *MockInjector_HealthCheck_Call
- func (_e *MockInjector_Expecter) HealthCheckWithContext(context1 interface{}) *MockInjector_HealthCheckWithContext_Call
- func (_e *MockInjector_Expecter) ID() *MockInjector_ID_Call
- func (_e *MockInjector_Expecter) ListInvokedServices() *MockInjector_ListInvokedServices_Call
- func (_e *MockInjector_Expecter) ListProvidedServices() *MockInjector_ListProvidedServices_Call
- func (_e *MockInjector_Expecter) Name() *MockInjector_Name_Call
- func (_e *MockInjector_Expecter) RootScope() *MockInjector_RootScope_Call
- func (_e *MockInjector_Expecter) Scope(s interface{}, fns ...interface{}) *MockInjector_Scope_Call
- func (_e *MockInjector_Expecter) Shutdown() *MockInjector_Shutdown_Call
- func (_e *MockInjector_Expecter) ShutdownWithContext(context1 interface{}) *MockInjector_ShutdownWithContext_Call
- type MockInjector_HealthCheckWithContext_Call
- func (_c *MockInjector_HealthCheckWithContext_Call) Return(stringToErr map[string]error) *MockInjector_HealthCheckWithContext_Call
- func (_c *MockInjector_HealthCheckWithContext_Call) Run(run func(context1 context.Context)) *MockInjector_HealthCheckWithContext_Call
- func (_c *MockInjector_HealthCheckWithContext_Call) RunAndReturn(run func(context1 context.Context) map[string]error) *MockInjector_HealthCheckWithContext_Call
- type MockInjector_HealthCheck_Call
- func (_c *MockInjector_HealthCheck_Call) Return(stringToErr map[string]error) *MockInjector_HealthCheck_Call
- func (_c *MockInjector_HealthCheck_Call) Run(run func()) *MockInjector_HealthCheck_Call
- func (_c *MockInjector_HealthCheck_Call) RunAndReturn(run func() map[string]error) *MockInjector_HealthCheck_Call
- type MockInjector_ID_Call
- type MockInjector_ListInvokedServices_Call
- func (_c *MockInjector_ListInvokedServices_Call) Return(serviceDescriptions []do.ServiceDescription) *MockInjector_ListInvokedServices_Call
- func (_c *MockInjector_ListInvokedServices_Call) Run(run func()) *MockInjector_ListInvokedServices_Call
- func (_c *MockInjector_ListInvokedServices_Call) RunAndReturn(run func() []do.ServiceDescription) *MockInjector_ListInvokedServices_Call
- type MockInjector_ListProvidedServices_Call
- func (_c *MockInjector_ListProvidedServices_Call) Return(serviceDescriptions []do.ServiceDescription) *MockInjector_ListProvidedServices_Call
- func (_c *MockInjector_ListProvidedServices_Call) Run(run func()) *MockInjector_ListProvidedServices_Call
- func (_c *MockInjector_ListProvidedServices_Call) RunAndReturn(run func() []do.ServiceDescription) *MockInjector_ListProvidedServices_Call
- type MockInjector_Name_Call
- type MockInjector_RootScope_Call
- type MockInjector_Scope_Call
- func (_c *MockInjector_Scope_Call) Return(scope *do.Scope) *MockInjector_Scope_Call
- func (_c *MockInjector_Scope_Call) Run(run func(s string, fns ...func(do.Injector))) *MockInjector_Scope_Call
- func (_c *MockInjector_Scope_Call) RunAndReturn(run func(s string, fns ...func(do.Injector)) *do.Scope) *MockInjector_Scope_Call
- type MockInjector_ShutdownWithContext_Call
- func (_c *MockInjector_ShutdownWithContext_Call) Return(shutdownReport *do.ShutdownReport) *MockInjector_ShutdownWithContext_Call
- func (_c *MockInjector_ShutdownWithContext_Call) Run(run func(context1 context.Context)) *MockInjector_ShutdownWithContext_Call
- func (_c *MockInjector_ShutdownWithContext_Call) RunAndReturn(run func(context1 context.Context) *do.ShutdownReport) *MockInjector_ShutdownWithContext_Call
- type MockInjector_Shutdown_Call
- type MockInjector_clone_Call
- func (_c *MockInjector_clone_Call) Return(scope1 *do.Scope) *MockInjector_clone_Call
- func (_c *MockInjector_clone_Call) Run(run func(rootScope *do.RootScope, scope *do.Scope)) *MockInjector_clone_Call
- func (_c *MockInjector_clone_Call) RunAndReturn(run func(rootScope *do.RootScope, scope *do.Scope) *do.Scope) *MockInjector_clone_Call
- type MockInjector_onServiceInvoke_Call
- func (_c *MockInjector_onServiceInvoke_Call) Return() *MockInjector_onServiceInvoke_Call
- func (_c *MockInjector_onServiceInvoke_Call) Run(run func(s string)) *MockInjector_onServiceInvoke_Call
- func (_c *MockInjector_onServiceInvoke_Call) RunAndReturn(run func(s string)) *MockInjector_onServiceInvoke_Call
- type MockInjector_serviceExistRec_Call
- func (_c *MockInjector_serviceExistRec_Call) Return(b bool) *MockInjector_serviceExistRec_Call
- func (_c *MockInjector_serviceExistRec_Call) Run(run func(s string)) *MockInjector_serviceExistRec_Call
- func (_c *MockInjector_serviceExistRec_Call) RunAndReturn(run func(s string) bool) *MockInjector_serviceExistRec_Call
- type MockInjector_serviceExist_Call
- type MockInjector_serviceForEachRec_Call
- func (_c *MockInjector_serviceForEachRec_Call) Return() *MockInjector_serviceForEachRec_Call
- func (_c *MockInjector_serviceForEachRec_Call) Run(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEachRec_Call
- func (_c *MockInjector_serviceForEachRec_Call) RunAndReturn(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEachRec_Call
- type MockInjector_serviceForEach_Call
- func (_c *MockInjector_serviceForEach_Call) Return() *MockInjector_serviceForEach_Call
- func (_c *MockInjector_serviceForEach_Call) Run(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEach_Call
- func (_c *MockInjector_serviceForEach_Call) RunAndReturn(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEach_Call
- type MockInjector_serviceGetRec_Call
- func (_c *MockInjector_serviceGetRec_Call) Return(v any, scope *do.Scope, b bool) *MockInjector_serviceGetRec_Call
- func (_c *MockInjector_serviceGetRec_Call) Run(run func(s string)) *MockInjector_serviceGetRec_Call
- func (_c *MockInjector_serviceGetRec_Call) RunAndReturn(run func(s string) (any, *do.Scope, bool)) *MockInjector_serviceGetRec_Call
- type MockInjector_serviceGet_Call
- func (_c *MockInjector_serviceGet_Call) Return(v any, b bool) *MockInjector_serviceGet_Call
- func (_c *MockInjector_serviceGet_Call) Run(run func(s string)) *MockInjector_serviceGet_Call
- func (_c *MockInjector_serviceGet_Call) RunAndReturn(run func(s string) (any, bool)) *MockInjector_serviceGet_Call
- type MockInjector_serviceHealthCheck_Call
- func (_c *MockInjector_serviceHealthCheck_Call) Return(err error) *MockInjector_serviceHealthCheck_Call
- func (_c *MockInjector_serviceHealthCheck_Call) Run(run func(context1 context.Context, s string)) *MockInjector_serviceHealthCheck_Call
- func (_c *MockInjector_serviceHealthCheck_Call) RunAndReturn(run func(context1 context.Context, s string) error) *MockInjector_serviceHealthCheck_Call
- type MockInjector_serviceSet_Call
- type MockInjector_serviceShutdown_Call
- func (_c *MockInjector_serviceShutdown_Call) Return(err error) *MockInjector_serviceShutdown_Call
- func (_c *MockInjector_serviceShutdown_Call) Run(run func(context1 context.Context, s string)) *MockInjector_serviceShutdown_Call
- func (_c *MockInjector_serviceShutdown_Call) RunAndReturn(run func(context1 context.Context, s string) error) *MockInjector_serviceShutdown_Call
- type Module
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveClusterProvisionerFactory ¶
func ResolveClusterProvisionerFactory( injector Injector, ) (clusterprovisioner.Factory, error)
ResolveClusterProvisionerFactory retrieves the cluster provisioner factory dependency from the injector with consistent error handling.
func ResolveTimer ¶
ResolveTimer retrieves the timer dependency from the injector with consistent error handling.
func RunEWithRuntime ¶
func RunEWithRuntime( runtimeContainer *Runtime, handler func(cmd *cobra.Command, injector Injector) error, ) func(*cobra.Command, []string) error
RunEWithRuntime returns a cobra RunE function that resolves dependencies using the provided runtime container. The handler is executed with the active command and resolved injector when the command runs.
func WithTimer ¶
func WithTimer( handler func(cmd *cobra.Command, injector Injector, tmr timer.Timer) error, ) func(cmd *cobra.Command, injector Injector) error
WithTimer decorates a handler to automatically resolve the timer dependency. This higher-order function simplifies command handlers that need timer access.
Types ¶
type Injector ¶
Injector is an alias for the underlying DI container implementation. This abstraction allows the codebase to remain independent of the specific DI library used.
type MockInjector ¶
MockInjector is an autogenerated mock type for the Injector type
func NewMockInjector ¶
func NewMockInjector(t interface {
mock.TestingT
Cleanup(func())
}) *MockInjector
NewMockInjector creates a new instance of MockInjector. 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 (*MockInjector) Ancestors ¶
func (_mock *MockInjector) Ancestors() []*do.Scope
Ancestors provides a mock function for the type MockInjector
func (*MockInjector) ChildByID ¶
func (_mock *MockInjector) ChildByID(s string) (*do.Scope, bool)
ChildByID provides a mock function for the type MockInjector
func (*MockInjector) ChildByName ¶
func (_mock *MockInjector) ChildByName(s string) (*do.Scope, bool)
ChildByName provides a mock function for the type MockInjector
func (*MockInjector) Children ¶
func (_mock *MockInjector) Children() []*do.Scope
Children provides a mock function for the type MockInjector
func (*MockInjector) EXPECT ¶
func (_m *MockInjector) EXPECT() *MockInjector_Expecter
func (*MockInjector) HealthCheck ¶
func (_mock *MockInjector) HealthCheck() map[string]error
HealthCheck provides a mock function for the type MockInjector
func (*MockInjector) HealthCheckWithContext ¶
func (_mock *MockInjector) HealthCheckWithContext(context1 context.Context) map[string]error
HealthCheckWithContext provides a mock function for the type MockInjector
func (*MockInjector) ID ¶
func (_mock *MockInjector) ID() string
ID provides a mock function for the type MockInjector
func (*MockInjector) ListInvokedServices ¶
func (_mock *MockInjector) ListInvokedServices() []do.ServiceDescription
ListInvokedServices provides a mock function for the type MockInjector
func (*MockInjector) ListProvidedServices ¶
func (_mock *MockInjector) ListProvidedServices() []do.ServiceDescription
ListProvidedServices provides a mock function for the type MockInjector
func (*MockInjector) Name ¶
func (_mock *MockInjector) Name() string
Name provides a mock function for the type MockInjector
func (*MockInjector) RootScope ¶
func (_mock *MockInjector) RootScope() *do.RootScope
RootScope provides a mock function for the type MockInjector
func (*MockInjector) Shutdown ¶
func (_mock *MockInjector) Shutdown() *do.ShutdownReport
Shutdown provides a mock function for the type MockInjector
func (*MockInjector) ShutdownWithContext ¶
func (_mock *MockInjector) ShutdownWithContext(context1 context.Context) *do.ShutdownReport
ShutdownWithContext provides a mock function for the type MockInjector
type MockInjector_Ancestors_Call ¶
MockInjector_Ancestors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ancestors'
func (*MockInjector_Ancestors_Call) Return ¶
func (_c *MockInjector_Ancestors_Call) Return(scopes []*do.Scope) *MockInjector_Ancestors_Call
func (*MockInjector_Ancestors_Call) Run ¶
func (_c *MockInjector_Ancestors_Call) Run(run func()) *MockInjector_Ancestors_Call
func (*MockInjector_Ancestors_Call) RunAndReturn ¶
func (_c *MockInjector_Ancestors_Call) RunAndReturn(run func() []*do.Scope) *MockInjector_Ancestors_Call
type MockInjector_ChildByID_Call ¶
MockInjector_ChildByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChildByID'
func (*MockInjector_ChildByID_Call) Return ¶
func (_c *MockInjector_ChildByID_Call) Return(scope *do.Scope, b bool) *MockInjector_ChildByID_Call
func (*MockInjector_ChildByID_Call) Run ¶
func (_c *MockInjector_ChildByID_Call) Run(run func(s string)) *MockInjector_ChildByID_Call
func (*MockInjector_ChildByID_Call) RunAndReturn ¶
func (_c *MockInjector_ChildByID_Call) RunAndReturn(run func(s string) (*do.Scope, bool)) *MockInjector_ChildByID_Call
type MockInjector_ChildByName_Call ¶
MockInjector_ChildByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChildByName'
func (*MockInjector_ChildByName_Call) Return ¶
func (_c *MockInjector_ChildByName_Call) Return(scope *do.Scope, b bool) *MockInjector_ChildByName_Call
func (*MockInjector_ChildByName_Call) Run ¶
func (_c *MockInjector_ChildByName_Call) Run(run func(s string)) *MockInjector_ChildByName_Call
func (*MockInjector_ChildByName_Call) RunAndReturn ¶
func (_c *MockInjector_ChildByName_Call) RunAndReturn(run func(s string) (*do.Scope, bool)) *MockInjector_ChildByName_Call
type MockInjector_Children_Call ¶
MockInjector_Children_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Children'
func (*MockInjector_Children_Call) Return ¶
func (_c *MockInjector_Children_Call) Return(scopes []*do.Scope) *MockInjector_Children_Call
func (*MockInjector_Children_Call) Run ¶
func (_c *MockInjector_Children_Call) Run(run func()) *MockInjector_Children_Call
func (*MockInjector_Children_Call) RunAndReturn ¶
func (_c *MockInjector_Children_Call) RunAndReturn(run func() []*do.Scope) *MockInjector_Children_Call
type MockInjector_Expecter ¶
type MockInjector_Expecter struct {
// contains filtered or unexported fields
}
func (*MockInjector_Expecter) Ancestors ¶
func (_e *MockInjector_Expecter) Ancestors() *MockInjector_Ancestors_Call
Ancestors is a helper method to define mock.On call
func (*MockInjector_Expecter) ChildByID ¶
func (_e *MockInjector_Expecter) ChildByID(s interface{}) *MockInjector_ChildByID_Call
ChildByID is a helper method to define mock.On call
- s string
func (*MockInjector_Expecter) ChildByName ¶
func (_e *MockInjector_Expecter) ChildByName(s interface{}) *MockInjector_ChildByName_Call
ChildByName is a helper method to define mock.On call
- s string
func (*MockInjector_Expecter) Children ¶
func (_e *MockInjector_Expecter) Children() *MockInjector_Children_Call
Children is a helper method to define mock.On call
func (*MockInjector_Expecter) HealthCheck ¶
func (_e *MockInjector_Expecter) HealthCheck() *MockInjector_HealthCheck_Call
HealthCheck is a helper method to define mock.On call
func (*MockInjector_Expecter) HealthCheckWithContext ¶
func (_e *MockInjector_Expecter) HealthCheckWithContext(context1 interface{}) *MockInjector_HealthCheckWithContext_Call
HealthCheckWithContext is a helper method to define mock.On call
- context1 context.Context
func (*MockInjector_Expecter) ID ¶
func (_e *MockInjector_Expecter) ID() *MockInjector_ID_Call
ID is a helper method to define mock.On call
func (*MockInjector_Expecter) ListInvokedServices ¶
func (_e *MockInjector_Expecter) ListInvokedServices() *MockInjector_ListInvokedServices_Call
ListInvokedServices is a helper method to define mock.On call
func (*MockInjector_Expecter) ListProvidedServices ¶
func (_e *MockInjector_Expecter) ListProvidedServices() *MockInjector_ListProvidedServices_Call
ListProvidedServices is a helper method to define mock.On call
func (*MockInjector_Expecter) Name ¶
func (_e *MockInjector_Expecter) Name() *MockInjector_Name_Call
Name is a helper method to define mock.On call
func (*MockInjector_Expecter) RootScope ¶
func (_e *MockInjector_Expecter) RootScope() *MockInjector_RootScope_Call
RootScope is a helper method to define mock.On call
func (*MockInjector_Expecter) Scope ¶
func (_e *MockInjector_Expecter) Scope(s interface{}, fns ...interface{}) *MockInjector_Scope_Call
Scope is a helper method to define mock.On call
- s string
- fns ...func(do.Injector)
func (*MockInjector_Expecter) Shutdown ¶
func (_e *MockInjector_Expecter) Shutdown() *MockInjector_Shutdown_Call
Shutdown is a helper method to define mock.On call
func (*MockInjector_Expecter) ShutdownWithContext ¶
func (_e *MockInjector_Expecter) ShutdownWithContext(context1 interface{}) *MockInjector_ShutdownWithContext_Call
ShutdownWithContext is a helper method to define mock.On call
- context1 context.Context
type MockInjector_HealthCheckWithContext_Call ¶
MockInjector_HealthCheckWithContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HealthCheckWithContext'
func (*MockInjector_HealthCheckWithContext_Call) Return ¶
func (_c *MockInjector_HealthCheckWithContext_Call) Return(stringToErr map[string]error) *MockInjector_HealthCheckWithContext_Call
func (*MockInjector_HealthCheckWithContext_Call) Run ¶
func (_c *MockInjector_HealthCheckWithContext_Call) Run(run func(context1 context.Context)) *MockInjector_HealthCheckWithContext_Call
func (*MockInjector_HealthCheckWithContext_Call) RunAndReturn ¶
func (_c *MockInjector_HealthCheckWithContext_Call) RunAndReturn(run func(context1 context.Context) map[string]error) *MockInjector_HealthCheckWithContext_Call
type MockInjector_HealthCheck_Call ¶
MockInjector_HealthCheck_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HealthCheck'
func (*MockInjector_HealthCheck_Call) Return ¶
func (_c *MockInjector_HealthCheck_Call) Return(stringToErr map[string]error) *MockInjector_HealthCheck_Call
func (*MockInjector_HealthCheck_Call) Run ¶
func (_c *MockInjector_HealthCheck_Call) Run(run func()) *MockInjector_HealthCheck_Call
func (*MockInjector_HealthCheck_Call) RunAndReturn ¶
func (_c *MockInjector_HealthCheck_Call) RunAndReturn(run func() map[string]error) *MockInjector_HealthCheck_Call
type MockInjector_ID_Call ¶
MockInjector_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID'
func (*MockInjector_ID_Call) Return ¶
func (_c *MockInjector_ID_Call) Return(s string) *MockInjector_ID_Call
func (*MockInjector_ID_Call) Run ¶
func (_c *MockInjector_ID_Call) Run(run func()) *MockInjector_ID_Call
func (*MockInjector_ID_Call) RunAndReturn ¶
func (_c *MockInjector_ID_Call) RunAndReturn(run func() string) *MockInjector_ID_Call
type MockInjector_ListInvokedServices_Call ¶
MockInjector_ListInvokedServices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListInvokedServices'
func (*MockInjector_ListInvokedServices_Call) Return ¶
func (_c *MockInjector_ListInvokedServices_Call) Return(serviceDescriptions []do.ServiceDescription) *MockInjector_ListInvokedServices_Call
func (*MockInjector_ListInvokedServices_Call) Run ¶
func (_c *MockInjector_ListInvokedServices_Call) Run(run func()) *MockInjector_ListInvokedServices_Call
func (*MockInjector_ListInvokedServices_Call) RunAndReturn ¶
func (_c *MockInjector_ListInvokedServices_Call) RunAndReturn(run func() []do.ServiceDescription) *MockInjector_ListInvokedServices_Call
type MockInjector_ListProvidedServices_Call ¶
MockInjector_ListProvidedServices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProvidedServices'
func (*MockInjector_ListProvidedServices_Call) Return ¶
func (_c *MockInjector_ListProvidedServices_Call) Return(serviceDescriptions []do.ServiceDescription) *MockInjector_ListProvidedServices_Call
func (*MockInjector_ListProvidedServices_Call) Run ¶
func (_c *MockInjector_ListProvidedServices_Call) Run(run func()) *MockInjector_ListProvidedServices_Call
func (*MockInjector_ListProvidedServices_Call) RunAndReturn ¶
func (_c *MockInjector_ListProvidedServices_Call) RunAndReturn(run func() []do.ServiceDescription) *MockInjector_ListProvidedServices_Call
type MockInjector_Name_Call ¶
MockInjector_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
func (*MockInjector_Name_Call) Return ¶
func (_c *MockInjector_Name_Call) Return(s string) *MockInjector_Name_Call
func (*MockInjector_Name_Call) Run ¶
func (_c *MockInjector_Name_Call) Run(run func()) *MockInjector_Name_Call
func (*MockInjector_Name_Call) RunAndReturn ¶
func (_c *MockInjector_Name_Call) RunAndReturn(run func() string) *MockInjector_Name_Call
type MockInjector_RootScope_Call ¶
MockInjector_RootScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RootScope'
func (*MockInjector_RootScope_Call) Return ¶
func (_c *MockInjector_RootScope_Call) Return(rootScope *do.RootScope) *MockInjector_RootScope_Call
func (*MockInjector_RootScope_Call) Run ¶
func (_c *MockInjector_RootScope_Call) Run(run func()) *MockInjector_RootScope_Call
func (*MockInjector_RootScope_Call) RunAndReturn ¶
func (_c *MockInjector_RootScope_Call) RunAndReturn(run func() *do.RootScope) *MockInjector_RootScope_Call
type MockInjector_Scope_Call ¶
MockInjector_Scope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Scope'
func (*MockInjector_Scope_Call) Return ¶
func (_c *MockInjector_Scope_Call) Return(scope *do.Scope) *MockInjector_Scope_Call
func (*MockInjector_Scope_Call) Run ¶
func (_c *MockInjector_Scope_Call) Run(run func(s string, fns ...func(do.Injector))) *MockInjector_Scope_Call
func (*MockInjector_Scope_Call) RunAndReturn ¶
func (_c *MockInjector_Scope_Call) RunAndReturn(run func(s string, fns ...func(do.Injector)) *do.Scope) *MockInjector_Scope_Call
type MockInjector_ShutdownWithContext_Call ¶
MockInjector_ShutdownWithContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShutdownWithContext'
func (*MockInjector_ShutdownWithContext_Call) Return ¶
func (_c *MockInjector_ShutdownWithContext_Call) Return(shutdownReport *do.ShutdownReport) *MockInjector_ShutdownWithContext_Call
func (*MockInjector_ShutdownWithContext_Call) Run ¶
func (_c *MockInjector_ShutdownWithContext_Call) Run(run func(context1 context.Context)) *MockInjector_ShutdownWithContext_Call
func (*MockInjector_ShutdownWithContext_Call) RunAndReturn ¶
func (_c *MockInjector_ShutdownWithContext_Call) RunAndReturn(run func(context1 context.Context) *do.ShutdownReport) *MockInjector_ShutdownWithContext_Call
type MockInjector_Shutdown_Call ¶
MockInjector_Shutdown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Shutdown'
func (*MockInjector_Shutdown_Call) Return ¶
func (_c *MockInjector_Shutdown_Call) Return(shutdownReport *do.ShutdownReport) *MockInjector_Shutdown_Call
func (*MockInjector_Shutdown_Call) Run ¶
func (_c *MockInjector_Shutdown_Call) Run(run func()) *MockInjector_Shutdown_Call
func (*MockInjector_Shutdown_Call) RunAndReturn ¶
func (_c *MockInjector_Shutdown_Call) RunAndReturn(run func() *do.ShutdownReport) *MockInjector_Shutdown_Call
type MockInjector_clone_Call ¶
MockInjector_clone_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'clone'
func (*MockInjector_clone_Call) Return ¶
func (_c *MockInjector_clone_Call) Return(scope1 *do.Scope) *MockInjector_clone_Call
func (*MockInjector_clone_Call) Run ¶
func (_c *MockInjector_clone_Call) Run(run func(rootScope *do.RootScope, scope *do.Scope)) *MockInjector_clone_Call
func (*MockInjector_clone_Call) RunAndReturn ¶
func (_c *MockInjector_clone_Call) RunAndReturn(run func(rootScope *do.RootScope, scope *do.Scope) *do.Scope) *MockInjector_clone_Call
type MockInjector_onServiceInvoke_Call ¶
MockInjector_onServiceInvoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'onServiceInvoke'
func (*MockInjector_onServiceInvoke_Call) Return ¶
func (_c *MockInjector_onServiceInvoke_Call) Return() *MockInjector_onServiceInvoke_Call
func (*MockInjector_onServiceInvoke_Call) Run ¶
func (_c *MockInjector_onServiceInvoke_Call) Run(run func(s string)) *MockInjector_onServiceInvoke_Call
func (*MockInjector_onServiceInvoke_Call) RunAndReturn ¶
func (_c *MockInjector_onServiceInvoke_Call) RunAndReturn(run func(s string)) *MockInjector_onServiceInvoke_Call
type MockInjector_serviceExistRec_Call ¶
MockInjector_serviceExistRec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceExistRec'
func (*MockInjector_serviceExistRec_Call) Return ¶
func (_c *MockInjector_serviceExistRec_Call) Return(b bool) *MockInjector_serviceExistRec_Call
func (*MockInjector_serviceExistRec_Call) Run ¶
func (_c *MockInjector_serviceExistRec_Call) Run(run func(s string)) *MockInjector_serviceExistRec_Call
func (*MockInjector_serviceExistRec_Call) RunAndReturn ¶
func (_c *MockInjector_serviceExistRec_Call) RunAndReturn(run func(s string) bool) *MockInjector_serviceExistRec_Call
type MockInjector_serviceExist_Call ¶
MockInjector_serviceExist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceExist'
func (*MockInjector_serviceExist_Call) Return ¶
func (_c *MockInjector_serviceExist_Call) Return(b bool) *MockInjector_serviceExist_Call
func (*MockInjector_serviceExist_Call) Run ¶
func (_c *MockInjector_serviceExist_Call) Run(run func(s string)) *MockInjector_serviceExist_Call
func (*MockInjector_serviceExist_Call) RunAndReturn ¶
func (_c *MockInjector_serviceExist_Call) RunAndReturn(run func(s string) bool) *MockInjector_serviceExist_Call
type MockInjector_serviceForEachRec_Call ¶
MockInjector_serviceForEachRec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceForEachRec'
func (*MockInjector_serviceForEachRec_Call) Return ¶
func (_c *MockInjector_serviceForEachRec_Call) Return() *MockInjector_serviceForEachRec_Call
func (*MockInjector_serviceForEachRec_Call) Run ¶
func (_c *MockInjector_serviceForEachRec_Call) Run(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEachRec_Call
func (*MockInjector_serviceForEachRec_Call) RunAndReturn ¶
func (_c *MockInjector_serviceForEachRec_Call) RunAndReturn(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEachRec_Call
type MockInjector_serviceForEach_Call ¶
MockInjector_serviceForEach_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceForEach'
func (*MockInjector_serviceForEach_Call) Return ¶
func (_c *MockInjector_serviceForEach_Call) Return() *MockInjector_serviceForEach_Call
func (*MockInjector_serviceForEach_Call) Run ¶
func (_c *MockInjector_serviceForEach_Call) Run(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEach_Call
func (*MockInjector_serviceForEach_Call) RunAndReturn ¶
func (_c *MockInjector_serviceForEach_Call) RunAndReturn(run func(fn func(string, *do.Scope, any) bool)) *MockInjector_serviceForEach_Call
type MockInjector_serviceGetRec_Call ¶
MockInjector_serviceGetRec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceGetRec'
func (*MockInjector_serviceGetRec_Call) Return ¶
func (_c *MockInjector_serviceGetRec_Call) Return(v any, scope *do.Scope, b bool) *MockInjector_serviceGetRec_Call
func (*MockInjector_serviceGetRec_Call) Run ¶
func (_c *MockInjector_serviceGetRec_Call) Run(run func(s string)) *MockInjector_serviceGetRec_Call
func (*MockInjector_serviceGetRec_Call) RunAndReturn ¶
func (_c *MockInjector_serviceGetRec_Call) RunAndReturn(run func(s string) (any, *do.Scope, bool)) *MockInjector_serviceGetRec_Call
type MockInjector_serviceGet_Call ¶
MockInjector_serviceGet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceGet'
func (*MockInjector_serviceGet_Call) Return ¶
func (_c *MockInjector_serviceGet_Call) Return(v any, b bool) *MockInjector_serviceGet_Call
func (*MockInjector_serviceGet_Call) Run ¶
func (_c *MockInjector_serviceGet_Call) Run(run func(s string)) *MockInjector_serviceGet_Call
func (*MockInjector_serviceGet_Call) RunAndReturn ¶
func (_c *MockInjector_serviceGet_Call) RunAndReturn(run func(s string) (any, bool)) *MockInjector_serviceGet_Call
type MockInjector_serviceHealthCheck_Call ¶
MockInjector_serviceHealthCheck_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceHealthCheck'
func (*MockInjector_serviceHealthCheck_Call) Return ¶
func (_c *MockInjector_serviceHealthCheck_Call) Return(err error) *MockInjector_serviceHealthCheck_Call
func (*MockInjector_serviceHealthCheck_Call) Run ¶
func (_c *MockInjector_serviceHealthCheck_Call) Run(run func(context1 context.Context, s string)) *MockInjector_serviceHealthCheck_Call
func (*MockInjector_serviceHealthCheck_Call) RunAndReturn ¶
func (_c *MockInjector_serviceHealthCheck_Call) RunAndReturn(run func(context1 context.Context, s string) error) *MockInjector_serviceHealthCheck_Call
type MockInjector_serviceSet_Call ¶
MockInjector_serviceSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceSet'
func (*MockInjector_serviceSet_Call) Return ¶
func (_c *MockInjector_serviceSet_Call) Return() *MockInjector_serviceSet_Call
func (*MockInjector_serviceSet_Call) Run ¶
func (_c *MockInjector_serviceSet_Call) Run(run func(s string, v any)) *MockInjector_serviceSet_Call
func (*MockInjector_serviceSet_Call) RunAndReturn ¶
func (_c *MockInjector_serviceSet_Call) RunAndReturn(run func(s string, v any)) *MockInjector_serviceSet_Call
type MockInjector_serviceShutdown_Call ¶
MockInjector_serviceShutdown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'serviceShutdown'
func (*MockInjector_serviceShutdown_Call) Return ¶
func (_c *MockInjector_serviceShutdown_Call) Return(err error) *MockInjector_serviceShutdown_Call
func (*MockInjector_serviceShutdown_Call) Run ¶
func (_c *MockInjector_serviceShutdown_Call) Run(run func(context1 context.Context, s string)) *MockInjector_serviceShutdown_Call
func (*MockInjector_serviceShutdown_Call) RunAndReturn ¶
func (_c *MockInjector_serviceShutdown_Call) RunAndReturn(run func(context1 context.Context, s string) error) *MockInjector_serviceShutdown_Call
type Module ¶
Module registers dependencies with the DI container. Each module is a function that configures one or more dependencies.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns shared dependency registration for Cobra commands. It maintains a list of base modules that are applied to every invocation.
func New ¶
New constructs a Runtime with the provided base modules. Modules are applied in the order supplied when invoking commands.
func NewRuntime ¶
func NewRuntime() *Runtime
NewRuntime constructs the shared runtime container used by root command and tests. It registers default implementations for timer and cluster provisioner factory.