singleton

package
v0.1.205 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 2 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 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 AddSingletonISingletonByObj

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

AddSingletonISingletonByObj adds a prebuilt obj

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 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