Documentation
¶
Overview ¶
Package ioc implements inversion of control containers and the dependency injection pattern. see https://martinfowler.com/articles/injection.html
Index ¶
- Variables
- func Register(ctx context.Context, name string, createNew CreateNew) error
- func RegisterInstance(ctx context.Context, name string, instance interface{}) error
- func Resolve(ctx context.Context, name string) (interface{}, error)
- func ResolveInstance(ctx context.Context, name string) (interface{}, error)
- type CreateNew
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHasRegistered = errors.New("ioc: type/instance has already been registered")
ErrHasRegistered 物件/實例已經被註冊
View Source
var ErrNoRegistered = errors.New("ioc: type/instance is not registered")
ErrNoRegistered 物件/實例未被註冊
Functions ¶
func RegisterInstance ¶
RegisterInstance 註冊全局的物件實例
Types ¶
Click to show internal directories.
Click to hide internal directories.