contextaccessor

package
v0.1.140 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeIContextAccessor = di.GetInterfaceReflectType((*IContextAccessor)(nil))

ReflectTypeIContextAccessor used when your service claims to implement IContextAccessor

View Source
var ReflectTypeIInternalContextAccessor = di.GetInterfaceReflectType((*IInternalContextAccessor)(nil))

ReflectTypeIInternalContextAccessor used when your service claims to implement IInternalContextAccessor

Functions

func AddScopedIContextAccessor

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

AddScopedIContextAccessor adds a type that implements IContextAccessor

func AddScopedIContextAccessorByFunc

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

AddScopedIContextAccessorByFunc adds a type by a custom func

func AddScopedIInternalContextAccessor

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

AddScopedIInternalContextAccessor adds a type that implements IInternalContextAccessor

func AddScopedIInternalContextAccessorByFunc

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

AddScopedIInternalContextAccessorByFunc adds a type by a custom func

func AddSingletonIContextAccessor

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

AddSingletonIContextAccessor adds a type that implements IContextAccessor

func AddSingletonIContextAccessorByFunc

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

AddSingletonIContextAccessorByFunc adds a type by a custom func

func AddSingletonIContextAccessorByObj

func AddSingletonIContextAccessorByObj(builder *di.Builder, obj interface{})

AddSingletonIContextAccessorByObj adds a prebuilt obj

func AddSingletonIInternalContextAccessor

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

AddSingletonIInternalContextAccessor adds a type that implements IInternalContextAccessor

func AddSingletonIInternalContextAccessorByFunc

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

AddSingletonIInternalContextAccessorByFunc adds a type by a custom func

func AddSingletonIInternalContextAccessorByObj

func AddSingletonIInternalContextAccessorByObj(builder *di.Builder, obj interface{})

AddSingletonIInternalContextAccessorByObj adds a prebuilt obj

func AddTransientIContextAccessor

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

AddTransientIContextAccessor adds a type that implements IContextAccessor

func AddTransientIContextAccessorByFunc

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

AddTransientIContextAccessorByFunc adds a type by a custom func

func AddTransientIInternalContextAccessor

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

AddTransientIInternalContextAccessor adds a type that implements IInternalContextAccessor

func AddTransientIInternalContextAccessorByFunc

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

AddTransientIInternalContextAccessorByFunc adds a type by a custom func

Types

type IContextAccessor

type IContextAccessor interface {
	GetContext() context.Context
	GetContainer() di.Container
}

IContextAccessor ...

func GetIContextAccessorFromContainer

func GetIContextAccessorFromContainer(ctn di.Container) IContextAccessor

GetIContextAccessorFromContainer alternative to SafeGetIContextAccessorFromContainer but panics of object is not present

func SafeGetIContextAccessorFromContainer

func SafeGetIContextAccessorFromContainer(ctn di.Container) (IContextAccessor, error)

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

type IInternalContextAccessor

type IInternalContextAccessor interface {
	IContextAccessor
	SetContext(context.Context)
}

IInternalContextAccessor ...

func GetIInternalContextAccessorFromContainer

func GetIInternalContextAccessorFromContainer(ctn di.Container) IInternalContextAccessor

GetIInternalContextAccessorFromContainer alternative to SafeGetIInternalContextAccessorFromContainer but panics of object is not present

func SafeGetIInternalContextAccessorFromContainer

func SafeGetIInternalContextAccessorFromContainer(ctn di.Container) (IInternalContextAccessor, error)

SafeGetIInternalContextAccessorFromContainer 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