singleton

package
v0.1.322 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeISingleton = di.GetInterfaceReflectType((*ISingleton)(nil))

ReflectTypeISingleton used when your service claims to implement ISingleton

Functions

func AddScopedISingleton

func AddScopedISingleton(builder *di.Builder, implType reflect.Type, implementedTypes ...reflect.Type)

AddScopedISingleton adds a type that implements ISingleton

func AddScopedISingletonByFunc

func AddScopedISingletonByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), implementedTypes ...reflect.Type)

AddScopedISingletonByFunc adds a type by a custom func

func AddScopedISingletonByFuncWithMetadata added in v0.1.217

func AddScopedISingletonByFuncWithMetadata(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddScopedISingletonByFuncWithMetadata adds a type by a custom func

func AddScopedISingletonWithMetadata added in v0.1.217

func AddScopedISingletonWithMetadata(builder *di.Builder, implType reflect.Type, metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddScopedISingletonWithMetadata adds a type that implements ISingleton

func AddSingletonISingleton

func AddSingletonISingleton(builder *di.Builder, implType reflect.Type, implementedTypes ...reflect.Type)

AddSingletonISingleton adds a type that implements ISingleton

func AddSingletonISingletonByFunc

func AddSingletonISingletonByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), implementedTypes ...reflect.Type)

AddSingletonISingletonByFunc adds a type by a custom func

func AddSingletonISingletonByFuncWithMetadata added in v0.1.217

func AddSingletonISingletonByFuncWithMetadata(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddSingletonISingletonByFuncWithMetadata adds a type by a custom func

func AddSingletonISingletonByObj

func AddSingletonISingletonByObj(builder *di.Builder, obj interface{}, implementedTypes ...reflect.Type)

AddSingletonISingletonByObj adds a prebuilt obj

func AddSingletonISingletonByObjWithMetadata added in v0.1.217

func AddSingletonISingletonByObjWithMetadata(builder *di.Builder, obj interface{}, metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddSingletonISingletonByObjWithMetadata adds a prebuilt obj

func AddSingletonISingletonWithMetadata added in v0.1.217

func AddSingletonISingletonWithMetadata(builder *di.Builder, implType reflect.Type, metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddSingletonISingletonWithMetadata adds a type that implements ISingleton

func AddTransientISingleton

func AddTransientISingleton(builder *di.Builder, implType reflect.Type, implementedTypes ...reflect.Type)

AddTransientISingleton adds a type that implements ISingleton

func AddTransientISingletonByFunc

func AddTransientISingletonByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), implementedTypes ...reflect.Type)

AddTransientISingletonByFunc adds a type by a custom func

func AddTransientISingletonByFuncWithMetadata added in v0.1.217

func AddTransientISingletonByFuncWithMetadata(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error), metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddTransientISingletonByFuncWithMetadata adds a type by a custom func

func AddTransientISingletonWithMetadata added in v0.1.217

func AddTransientISingletonWithMetadata(builder *di.Builder, implType reflect.Type, metaData map[string]interface{}, implementedTypes ...reflect.Type)

AddTransientISingletonWithMetadata adds a type that implements ISingleton

func GetISingletonDefinition added in v0.1.217

func GetISingletonDefinition(ctn di.Container) *di.Def

GetISingletonDefinition returns that last definition registered that this container can provide

func GetISingletonDefinitions added in v0.1.217

func GetISingletonDefinitions(ctn di.Container) []*di.Def

GetISingletonDefinitions returns all definitions that this container can provide

func RemoveAllISingleton

func RemoveAllISingleton(builder *di.Builder)

RemoveAllISingleton removes all ISingleton from the DI

Types

type ISingleton

type ISingleton interface {
	SetName(in string)
	GetName() string
}

ISingleton ...

func GetISingletonFromContainer

func GetISingletonFromContainer(ctn di.Container) ISingleton

GetISingletonFromContainer alternative to SafeGetISingletonFromContainer but panics of object is not present

func GetManyISingletonFromContainer

func GetManyISingletonFromContainer(ctn di.Container) []ISingleton

GetManyISingletonFromContainer alternative to SafeGetManyISingletonFromContainer but panics of object is not present

func SafeGetISingletonFromContainer

func SafeGetISingletonFromContainer(ctn di.Container) (ISingleton, error)

SafeGetISingletonFromContainer trys to get the object by type, will not panic, returns nil and error

func SafeGetManyISingletonFromContainer

func SafeGetManyISingletonFromContainer(ctn di.Container) ([]ISingleton, error)

SafeGetManyISingletonFromContainer trys to get the object by type, will not panic, returns nil and error

Jump to

Keyboard shortcuts

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