Documentation
¶
Index ¶
- Constants
- Variables
- func DIHandler(container *Container, instanceName string, funcName string, isRaw bool) func(w http.ResponseWriter, r *http.Request)
- func DIRouter(r mux, container *Container)
- func DiFree(log logrus.FieldLogger, dest interface{})
- func InitInstance(container *Container)
- func RegisterController(rootPath string, instanceName string, requestMaps ...RequestMap)
- func RegisterInstance(instanceName string, instancePool *sync.Pool)
- func RouterSelfCheck(container *Container)
- 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) RegisterInstance(instanceName string, instancePool *sync.Pool)
- func (s *Container) Release(instanceName string, instance interface{})
- type Keyword
- type RequestMap
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 DIHandler ¶
func DIHandler(container *Container, instanceName string, funcName string, isRaw bool) func(w http.ResponseWriter, r *http.Request)
multi instance di handler
func DiFree ¶
func DiFree(log logrus.FieldLogger, dest interface{})
func InitInstance ¶
func InitInstance(container *Container)
func RegisterController ¶
func RegisterController(rootPath string, instanceName string, requestMaps ...RequestMap)
func RegisterInstance ¶
func RouterSelfCheck ¶
func RouterSelfCheck(container *Container)
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) RegisterInstance ¶
RegisterInstance register new instance if instanceName is empty will fatal if instancePool is invalid , will fatal
type RequestMap ¶
type RequestMap struct {
// contains filtered or unexported fields
}
func NewRawRequestMapping ¶
func NewRequestMapping ¶
Click to show internal directories.
Click to hide internal directories.