Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivatorFunc ¶
type ActivatorFunc func(params ...interface{}) (interface{}, error)
ActivatorFunc creates a new instance of specified type.
type Container ¶
type Container interface { // Add inserts the instance creation activator with the type value. Add(t InstanceType, activator ActivatorFunc) // GetInstance creates new instance associated with the type value. GetInstance(t InstanceType, p ...interface{}) (interface{}, error) }
Container is the ioc container. It manages the life cycle of instance creation.
type DefaultContainer ¶
type DefaultContainer struct {
// contains filtered or unexported fields
}
DefaultContainer implements the dependency injection container.
func (*DefaultContainer) Add ¶
func (c *DefaultContainer) Add(t InstanceType, activator ActivatorFunc)
Add inserts the instance creation activator in the container.
func (*DefaultContainer) GetInstance ¶
func (c *DefaultContainer) GetInstance(t InstanceType, params ...interface{}) (interface{}, error)
GetInstance creates new instance of the specified type value.
type InstanceType ¶
type InstanceType uint16
InstanceType represents the instance type enum.
const ( // InstanceTypeAuth is the enum member of type auth. InstanceTypeAuth InstanceType = iota // InstanceTypeUserinfo is the enum member of type userinfo. InstanceTypeUserinfo // InstanceTypeNotestore is the enum member of type notestore. InstanceTypeNotestore // InstanceTypeSectionstore is the enum member of type sectionstore. InstanceTypeSectionstore )
Click to show internal directories.
Click to hide internal directories.