di-go/annotations/component.go
2019-11-13 22:34:36 +09:00

23 lines
618 B
Go

package annotations
// @Inject(name? string)
import (
"reflect"
"git.loafle.net/loafer/annotation-go"
)
var ComponentAnnotationType = reflect.TypeOf((*ComponentAnnotation)(nil))
func init() {
annotation.Register(ComponentAnnotationType)
}
type ComponentAnnotation struct {
annotation.TypeAnnotation `@annotation:"@Component"`
Name string `json:"name"`
InitMethod string `json:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
DestroyMethod string `json:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
}