Documentation
¶
Index ¶
- Constants
- func GetCommentParam(c *ast.CommentGroup, a Annotation) (ret map[AnnotationKey]string)
- func GetProxyTpl() string
- func IsSystemAnnotation(anno Annotation) bool
- func IsSystemAnnotationKey(key AnnotationKey) bool
- func IsTypeIdent(expr ast.Expr) (*ast.Ident, bool)
- func ParseAdviceStmt(advice aspect.Advice, method aspect.Method) []string
- func ParseAroundAdvice(advice aspect.Advice, method aspect.Method) ([]string, []string)
- func RegisterFieldInterceptors(opts ...FieldInterceptor)
- func RegisterProxyInterceptors(opts ...ProxyInterceptor)
- type Annotation
- type AnnotationKey
- type FieldInterceptor
- type File
- type Package
- type ProxyData
- type ProxyImport
- type ProxyInjectField
- type ProxyInterceptor
- type ProxyMethod
Constants ¶
View Source
const ( // CommentProxy for struct while comment @Proxy generate a file with _gen.go suffix CommentProxy = Annotation("@Proxy") // CommentPointcut for struct function while comment @Pointcut generate a proxy func for proxy struct CommentPointcut = Annotation("@Pointcut") // CommentAspect for struct while comment @Aspect then use to enhance other function CommentAspect = Annotation("@Aspect") // CommentAdviceBefore for struct function while comment @Before then use to enhance other function CommentAdviceBefore = Annotation("@Before") // CommentAdviceAfter for struct function while comment @After then use to enhance other function CommentAdviceAfter = Annotation("@After") // CommentAdviceAround for struct function while comment @Around then use to enhance other function CommentAdviceAround = Annotation("@Around") // CommentComponent for struct factory method while comment @Component then use to inject proxy struct CommentComponent = Annotation("@Component") // CommentInject for struct field while comment @Inject then use to inject proxy struct CommentInject = Annotation("@Inject") // CommentKeyDefault key for comment params separated by "=" CommentKeyDefault = AnnotationKey("default") // CommentKeyDefault abstract key for @Proxy comment CommentKeyAbstract = AnnotationKey("abstract") CommentKeySuffix = AnnotationKey("suffix") CommentKeyCustom = AnnotationKey("custom") CommentKeyOption = AnnotationKey("option") CommentKeySingleton = AnnotationKey("singleton") )
View Source
const (
DefaultProxySuffix = "Proxy"
)
Variables ¶
This section is empty.
Functions ¶
func GetCommentParam ¶
func GetCommentParam(c *ast.CommentGroup, a Annotation) (ret map[AnnotationKey]string)
func GetProxyTpl ¶
func GetProxyTpl() string
func IsSystemAnnotation ¶
func IsSystemAnnotation(anno Annotation) bool
func IsSystemAnnotationKey ¶
func IsSystemAnnotationKey(key AnnotationKey) bool
func ParseAroundAdvice ¶
func RegisterFieldInterceptors ¶
func RegisterFieldInterceptors(opts ...FieldInterceptor)
func RegisterProxyInterceptors ¶
func RegisterProxyInterceptors(opts ...ProxyInterceptor)
Types ¶
type Annotation ¶
type Annotation string
func AdviceAnnotationList ¶
func AdviceAnnotationList() []Annotation
func (Annotation) String ¶
func (a Annotation) String() string
type AnnotationKey ¶
type AnnotationKey string
type FieldInterceptor ¶
type FieldInterceptor func([]Annotation, aspect.Field, *ast.Field) []aspect.FieldOption
type File ¶
type File struct { Pkg *Package // Package to which this file belongs. File *ast.File // Parsed AST. Imports map[string]string }
File holds a single parsed file and associated data.
type Package ¶
type Package struct { Path string Pwd string Name string AstPkg *packages.Package Files []*File Defs map[*ast.Ident]types.Object OutputFiles map[string][]byte FileBuf map[string]bytes.Buffer AspectCache map[string]aspect.Aspect AspectAlias map[string]string AspectCustoms map[Annotation]string ProxyCache map[*ast.Ident]aspect.Proxy DelayAspectLoader map[Annotation][]func() ComponentCache map[string]aspect.Component }
func (*Package) ImportPath ¶
type ProxyData ¶
type ProxyData struct { Package string Imports []*ProxyImport ProxyStructName string Option string Methods []*ProxyMethod AbstractName string ParentName string InjectFields []*ProxyInjectField Singleton bool }
type ProxyImport ¶
func GetImports ¶
func GetImports(specs []*ast.ImportSpec) []*ProxyImport
type ProxyInterceptor ¶
type ProxyInterceptor func([]Annotation, aspect.Proxy, *ast.StructType) []aspect.ProxyOption
Click to show internal directories.
Click to hide internal directories.