27 lines
670 B
Go
27 lines
670 B
Go
package annotation
|
|
|
|
// @Inject(name? string)
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"git.loafle.net/commons_go/di"
|
|
cda "git.loafle.net/commons_go/di/annotation"
|
|
)
|
|
|
|
const (
|
|
ComponentTag = "@Component"
|
|
)
|
|
|
|
func init() {
|
|
cda.RegisterAnnotation(ComponentTag, reflect.TypeOf((*Component)(nil)))
|
|
}
|
|
|
|
type Component struct {
|
|
cda.Annotation
|
|
Name string `annotation-meta:"name"`
|
|
InitMethod string `annotation-meta:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
|
DestroyMethod string `annotation-meta:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
|
|
Scope di.ScopeType `annotation-meta:"scope"`
|
|
}
|