instance

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStructName

func GetStructName(i interface{}) string

Types

type ApplicationContext

type ApplicationContext struct {
	// contains filtered or unexported fields
}

ApplicationContext定义

func NewApplicationContext

func NewApplicationContext() *ApplicationContext

NewApplicationContext创建一个新的ApplicationContext

func (*ApplicationContext) GetInstanceByName

func (ctx *ApplicationContext) GetInstanceByName(instanceName string) (interface{}, error)

GetInstance根据InstanceName获取实例

func (*ApplicationContext) GetInstanceByType

func (ctx *ApplicationContext) GetInstanceByType(instanceType interface{}) (interface{}, error)

GetInstance根据类型获取实例

func (*ApplicationContext) MustGetInstance

func (ctx *ApplicationContext) MustGetInstance(instanceTypeOrName interface{}) interface{}

MustGetInstance获取实例,如果不存在则panic

func (*ApplicationContext) RegisterInstance

func (ctx *ApplicationContext) RegisterInstance(instance interface{})

RegisterInstance注册一个实例

func (*ApplicationContext) RegisterInstanceWithName

func (ctx *ApplicationContext) RegisterInstanceWithName(instance interface{}, instanceName string)

Jump to

Keyboard shortcuts

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