container

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagOptionNotRequired = "NR" // Not Required, 标注该字段在执行注入时, 如果没有找到对应的实例, 则忽略该字段
)

Variables

View Source
var (
	ErrorDependNotCompleted = errors.New("依赖尚未完成")
)

Functions

This section is empty.

Types

type Container

type Container struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Container 容器实现

func New

func New() *Container

func NewWithParent

func NewWithParent(parent *Container) *Container

NewWithParent 创建一个新的容器, 并指定父容器

func (*Container) Get

func (c *Container) Get(plugin plugin.Plugin, names ...string) (interface{}, error)

func (*Container) Invoke

func (c *Container) Invoke(fn interface{}) ([]reflect.Value, error)

func (*Container) NewChild

func (c *Container) NewChild() *Container

func (*Container) Populate

func (c *Container) Populate() error

func (*Container) PopulateSingle

func (c *Container) PopulateSingle(val plugin.Plugin, opts ...Option) (bool, error)

func (*Container) Provide

func (c *Container) Provide(plug plugin.Plugin, opts ...Option) error

func (*Container) ProvideFunc

func (c *Container) ProvideFunc(v interface{}, opts ...Option) error

type InjectTag

type InjectTag map[string]string

InjectTag 注入的所有 tag

type Option

type Option func(*entity)

func WithAlias

func WithAlias(alias string) Option

Jump to

Keyboard shortcuts

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