2017-12-03 13:54:09 +00:00
|
|
|
package registry
|
|
|
|
|
2017-12-05 13:28:42 +00:00
|
|
|
import (
|
2017-12-06 00:48:03 +00:00
|
|
|
"fmt"
|
2017-12-05 13:28:42 +00:00
|
|
|
"reflect"
|
2017-12-03 13:54:09 +00:00
|
|
|
|
2017-12-05 13:28:42 +00:00
|
|
|
cda "git.loafle.net/commons_go/di/annotation"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TypeDefinition struct {
|
2017-12-06 00:48:03 +00:00
|
|
|
FullName string
|
2017-12-05 10:02:41 +00:00
|
|
|
PkgName string
|
|
|
|
TypeName string
|
|
|
|
Type reflect.Type
|
|
|
|
RealType reflect.Type
|
2017-12-05 13:28:42 +00:00
|
|
|
|
2017-12-08 10:32:59 +00:00
|
|
|
Fields []*FieldDefinition
|
2017-12-05 13:28:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type FieldDefinition struct {
|
2017-12-08 10:32:59 +00:00
|
|
|
FieldName string
|
|
|
|
PkgName string
|
|
|
|
TypeName string
|
|
|
|
Type reflect.Type
|
|
|
|
RealType reflect.Type
|
|
|
|
|
|
|
|
Annotations map[string]cda.Annotation
|
|
|
|
}
|
2017-12-05 13:28:42 +00:00
|
|
|
|
2017-12-08 10:32:59 +00:00
|
|
|
func (fd *FieldDefinition) GetAnnotation(name string) cda.Annotation {
|
|
|
|
if nil == fd.Annotations {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return fd.Annotations[name]
|
2017-12-03 13:54:09 +00:00
|
|
|
}
|
2017-12-06 00:48:03 +00:00
|
|
|
|
|
|
|
func FullName(pkgName, typeName string) string {
|
|
|
|
return fmt.Sprintf("%s/%s", pkgName, typeName)
|
|
|
|
}
|