scoped

package
v0.1.212 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeIScoped = di.GetInterfaceReflectType((*IScoped)(nil))

ReflectTypeIScoped used when your service claims to implement IScoped

Functions

func AddScopedIScoped

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

AddScopedIScoped adds a type that implements IScoped

func AddScopedIScopedByFunc

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

AddScopedIScopedByFunc adds a type by a custom func

func AddSingletonIScoped

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

AddSingletonIScoped adds a type that implements IScoped

func AddSingletonIScopedByFunc

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

AddSingletonIScopedByFunc adds a type by a custom func

func AddSingletonIScopedByObj

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

AddSingletonIScopedByObj adds a prebuilt obj

func AddTransientIScoped

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

AddTransientIScoped adds a type that implements IScoped

func AddTransientIScopedByFunc

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

AddTransientIScopedByFunc adds a type by a custom func

func RemoveAllIScoped

func RemoveAllIScoped(builder *di.Builder)

RemoveAllIScoped removes all IScoped from the DI

Types

type IScoped

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

IScoped ...

func GetIScopedFromContainer

func GetIScopedFromContainer(ctn di.Container) IScoped

GetIScopedFromContainer alternative to SafeGetIScopedFromContainer but panics of object is not present

func GetManyIScopedFromContainer

func GetManyIScopedFromContainer(ctn di.Container) []IScoped

GetManyIScopedFromContainer alternative to SafeGetManyIScopedFromContainer but panics of object is not present

func SafeGetIScopedFromContainer

func SafeGetIScopedFromContainer(ctn di.Container) (IScoped, error)

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

func SafeGetManyIScopedFromContainer

func SafeGetManyIScopedFromContainer(ctn di.Container) ([]IScoped, error)

SafeGetManyIScopedFromContainer 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