host

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHostedLifecycleRoutine

func AddHostedLifecycleRoutine[U IHostedLifecycleRoutine](builder IBuilder)

func AddHostedRoutine

func AddHostedRoutine[U IHostedRoutine](builder IBuilder)

func AddKeyedOption

func AddKeyedOption[T any](builder IBuilder, key string, path string)

func AddKeyedOptionFactory

func AddKeyedOptionFactory[T any](builder IBuilder, key string, factory func() T)

func AddKeyedScoped

func AddKeyedScoped[U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddKeyedScopedFactory

func AddKeyedScopedFactory[U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddKeyedSingleton

func AddKeyedSingleton[U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddKeyedSingletonFactory

func AddKeyedSingletonFactory[U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddKeyedTransient

func AddKeyedTransient[U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddKeyedTransientFactory

func AddKeyedTransientFactory[U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddLogFormatter

func AddLogFormatter(builder IBuilder, name string, formatter func(logData *logging.LogData) string)

func AddLogHandler

func AddLogHandler[T logging.ILogHandler](builder IBuilder, factory func() T)

func AddOption

func AddOption[T any](builder IBuilder, path string)

func AddOptionFactory

func AddOptionFactory[T any](builder IBuilder, factory func() T)

func AddScoped

func AddScoped[U any](builder IBuilder) *injection.RoutineDescriptor

func AddScopedFactory

func AddScopedFactory[U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddSingleton

func AddSingleton[U any](builder IBuilder) *injection.RoutineDescriptor

func AddSingletonFactory

func AddSingletonFactory[U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddTransient

func AddTransient[U any](builder IBuilder) *injection.RoutineDescriptor

func AddTransientFactory

func AddTransientFactory[U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantKeyedScoped

func AddVariantKeyedScoped[T, U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddVariantKeyedScopedFactory

func AddVariantKeyedScopedFactory[T, U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantKeyedSingleton

func AddVariantKeyedSingleton[T, U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddVariantKeyedSingletonFactory

func AddVariantKeyedSingletonFactory[T, U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantKeyedTransient

func AddVariantKeyedTransient[T, U any](builder IBuilder, key any) *injection.RoutineDescriptor

func AddVariantKeyedTransientFactory

func AddVariantKeyedTransientFactory[T, U any](builder IBuilder, key any, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantScoped

func AddVariantScoped[T, U any](builder IBuilder) *injection.RoutineDescriptor

func AddVariantScopedFactory

func AddVariantScopedFactory[T, U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantSingleton

func AddVariantSingleton[T, U any](builder IBuilder) *injection.RoutineDescriptor

func AddVariantSingletonFactory

func AddVariantSingletonFactory[T, U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func AddVariantTransient

func AddVariantTransient[T, U any](builder IBuilder) *injection.RoutineDescriptor

func AddVariantTransientFactory

func AddVariantTransientFactory[T, U any](builder IBuilder, factory func(scope injection.IRoutineScope) U) *injection.RoutineDescriptor

func GetRoutine

func GetRoutine[T any](provider injection.IRoutineProvider) T

func Inject

func Inject(scope injection.IRoutineScope, instance any) bool

func NewStruct

func NewStruct[T any]() T

NewStruct 通过反射创建指定类型 T 的实例,类型 T 必须为结构体指针

func Run

func Run(h IHost)

Types

type IBuilder

type IBuilder interface {
	GetRoutineCollection() injection.IRoutineCollection
	GetRoutineProvider() injection.IRoutineProvider
	Build() IHost
}

type IHost

type IHost interface {
	IHostedRoutine

	GetRoutineProvider() injection.IRoutineProvider
}

type IHostApplication

type IHostApplication interface {
	OnStarted(listener func())
	OnStopped(listener func())
	OnStopping(listener func())

	StopApplication()
}

type IHostedLifecycleRoutine

type IHostedLifecycleRoutine interface {
	IHostedRoutine

	BeforeStart(ctx context.Context, wg *sync.TimeoutWaitGroup)
	AfterStart(ctx context.Context, wg *sync.TimeoutWaitGroup)
	BeforeStop(ctx context.Context, wg *sync.TimeoutWaitGroup)
	AfterStop(ctx context.Context, wg *sync.TimeoutWaitGroup)
}

type IHostedLifecycleRoutineContainer

type IHostedLifecycleRoutineContainer interface {
	AddHostedLifecycleRoutine(factory func() IHostedLifecycleRoutine)
	BuildHostedLifecycleRoutines()
	GetHostedLifecycleRoutines() []IHostedLifecycleRoutine
}

type IHostedRoutine

type IHostedRoutine interface {
	Start(ctx context.Context, wg *sync.TimeoutWaitGroup)
	Stop(ctx context.Context, wg *sync.TimeoutWaitGroup)
}

type IHostedRoutineContainer

type IHostedRoutineContainer interface {
	AddHostedRoutine(factory func() IHostedRoutine)
	BuildHostedRoutines()
	GetHostedRoutines() []IHostedRoutine
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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