di-go/annotation/injectable.go
2018-08-23 17:06:25 +09:00

32 lines
694 B
Go

package annotation
// @Inject(name? string)
import (
"reflect"
oa "git.loafle.net/overflow/annotation-go"
)
func init() {
oa.Register(InjectableAnnotationType)
}
var InjectableAnnotationType = reflect.TypeOf((*InjectableAnnotation)(nil))
type InjectableAnnotation struct {
oa.Annotation `@name:"@Injectable"`
Name string `json:"name" @default:""`
InitMethod string `json:"initMethod"`
DestroyMethod string `json:"destroyMethod"`
Scope ScopeType `json:"scope"`
}
type ScopeType string
const (
ScopeTypeDefault ScopeType = "Default" // == ScopeTypeSingleton
ScopeTypeSingleton ScopeType = "Singleton"
ScopeTypeTransiant ScopeType = "Transiant"
)