transient

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 ReflectTypeITransient = di.GetInterfaceReflectType((*ITransient)(nil))

ReflectTypeITransient used when your service claims to implement ITransient

Functions

func AddScopedITransient

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

AddScopedITransient adds a type that implements ITransient

func AddScopedITransientByFunc

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

AddScopedITransientByFunc adds a type by a custom func

func AddSingletonITransient

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

AddSingletonITransient adds a type that implements ITransient

func AddSingletonITransientByFunc

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

AddSingletonITransientByFunc adds a type by a custom func

func AddSingletonITransientByObj

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

AddSingletonITransientByObj adds a prebuilt obj

func AddTransientITransient

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

AddTransientITransient adds a type that implements ITransient

func AddTransientITransientByFunc

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

AddTransientITransientByFunc adds a type by a custom func

func RemoveAllITransient

func RemoveAllITransient(builder *di.Builder)

RemoveAllITransient removes all ITransient from the DI

Types

type ITransient

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

ITransient ...

func GetITransientFromContainer

func GetITransientFromContainer(ctn di.Container) ITransient

GetITransientFromContainer alternative to SafeGetITransientFromContainer but panics of object is not present

func GetManyITransientFromContainer

func GetManyITransientFromContainer(ctn di.Container) []ITransient

GetManyITransientFromContainer alternative to SafeGetManyITransientFromContainer but panics of object is not present

func SafeGetITransientFromContainer

func SafeGetITransientFromContainer(ctn di.Container) (ITransient, error)

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

func SafeGetManyITransientFromContainer

func SafeGetManyITransientFromContainer(ctn di.Container) ([]ITransient, error)

SafeGetManyITransientFromContainer 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