cpregister

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllExplicitProviderCreatorMap = map[string]servicehub.Provider{}

AllExplicitProviderCreatorMap contains all user specified provider.

Functions

func RegisterComponent

func RegisterComponent(scenario, componentName string, componentCreator protocol.ComponentCreator)

RegisterComponent register legacy component which implements protocol.RenderCreator

func RegisterLegacyComponent

func RegisterLegacyComponent(scenario, componentName string, componentCreator protocol.RenderCreator)

RegisterLegacyComponent register legacy component which implements protocol.RenderCreator For most scenarios, you should use RegisterComponent.

func RegisterProviderComponent

func RegisterProviderComponent(scenario, componentName string, providerPtr ComponentCreatorAndProvider, opFuncs ...OpFunc)

RegisterProviderComponent register a provider to component. Normally this provider will use servicehub's auto dependency injection feature.

Types

type ComponentCreatorAndProvider

type ComponentCreatorAndProvider interface {
	cptype.IComponent
	servicehub.Provider
}

ComponentCreatorAndProvider used for RegisterProviderComponent.

type HubListener

type HubListener struct {
	ScenarioFSs []embed.FS
}

HubListener .

func NewHubListener

func NewHubListener(fs ...embed.FS) *HubListener

NewHubListener .

func (*HubListener) AfterInitialization

func (l *HubListener) AfterInitialization(h *servicehub.Hub) error

AfterInitialization .

func (*HubListener) AfterStart

func (l *HubListener) AfterStart(h *servicehub.Hub) error

AfterStart .

func (*HubListener) BeforeExit

func (l *HubListener) BeforeExit(h *servicehub.Hub, err error) error

BeforeExit .

func (*HubListener) BeforeInitialization

func (l *HubListener) BeforeInitialization(h *servicehub.Hub, config map[string]interface{}) error

BeforeInitialization .

type OpFunc

type OpFunc func(*Option)

OpFunc do function for option.

type Option

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

Option represents options when register.

func (*Option) WithCustomProviderSpecButCreator

func (o *Option) WithCustomProviderSpecButCreator(spec *servicehub.Spec)

WithCustomProviderSpecButCreator use custom spec as base but ignore creator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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