Documentation
¶
Index ¶
- Constants
- Variables
- func DiFree(log logrus.FieldLogger, dest interface{})
- type Config
- type Container
- func (s *Container) CheckInstanceNameIfExist(instanceName string) bool
- func (s *Container) DiAllFields(dest interface{}, injectingMap map[string]interface{})
- func (s *Container) DiSelfCheck(instanceName string) error
- func (s *Container) GetInstance(instanceName string, injectingMap map[string]interface{}) interface{}
- func (s *Container) InstanceDISelfCheck() error
- func (s *Container) Log() logrus.FieldLogger
- func (s *Container) RegisterInstance(instanceName string, instancePool *sync.Pool)
- func (s *Container) Release(instanceName string, instance interface{})
- type Keyword
Constants ¶
View Source
const ( CONTAINER Keyword = "container" AUTOWIRE Keyword = "autowire" RESOURCE Keyword = "resource" TAG_SPLITER = ";" TAG_KV_SPLITER = ":" CONTEXT = "CONTEXT" )
Variables ¶
View Source
var ( DefaultConfig = &Config{ AutoWired: true, Log: logrus.New(), } )
Functions ¶
func DiFree ¶
func DiFree(log logrus.FieldLogger, dest interface{})
Types ¶
type Config ¶
type Config struct {
// AutoWired
// the default value of autowired
AutoWired bool
Log logrus.FieldLogger
}
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
NewContainer get the new container instance if not passing the config , will init with the default config
func (*Container) CheckInstanceNameIfExist ¶
CheckInstanceNameIfExist check instance name if exist if exist , return true if not exist , return false
func (*Container) DiAllFields ¶
func (*Container) DiSelfCheck ¶
DiSelfCheck check if the registered instance is invalid
func (*Container) GetInstance ¶
func (s *Container) GetInstance(instanceName string, injectingMap map[string]interface{}) interface{}
InstanceDISelfCheck get instance by instance name injectingMap , the dependency instance, will inject the instance in injectingMap as priority
func (*Container) InstanceDISelfCheck ¶
InstanceDISelfCheck self check all the instance registered exist or not
func (*Container) Log ¶ added in v0.1.2
func (s *Container) Log() logrus.FieldLogger
func (*Container) RegisterInstance ¶
RegisterInstance register new instance if instanceName is empty will fatal if instancePool is invalid , will fatal
Click to show internal directories.
Click to hide internal directories.