Documentation ¶
Index ¶
- Constants
- Variables
- func IsTracing() bool
- func StartTrace() (err error)
- type AOP
- type Advice
- type AdviceOrdering
- type Args
- type Aspect
- func (p *Aspect) AddAdvice(advice *Advice) *Aspect
- func (p *Aspect) AddPointcut(pointcut *Pointcut) *Aspect
- func (p *Aspect) BeanRefID() string
- func (p *Aspect) GetMatchedAdvices(bean *Bean, methodName string, args Args) (advices map[AdviceOrdering][]*Advice, err error)
- func (p *Aspect) ID() string
- func (p *Aspect) SetBeanFactory(factory BeanFactory)
- type Bean
- type BeanFactory
- type BeanFactoryAware
- type ClassicBeanFactory
- type InvokeResult
- type JoinPoint
- type JoinPointer
- type MethodMetadata
- type Pointcut
- func (p *Pointcut) Bean(expr string) *Pointcut
- func (p *Pointcut) Execution(expr string) *Pointcut
- func (p *Pointcut) ID() string
- func (p *Pointcut) IsMatch(bean *Bean, methodName string, args Args) bool
- func (p *Pointcut) NotBean(expr string) *Pointcut
- func (p *Pointcut) NotExecution(expr string) *Pointcut
- func (p *Pointcut) NotWithin(expr string) *Pointcut
- func (p *Pointcut) Within(expr string) *Pointcut
- type ProceedingJoinPoint
- type ProceedingJoinPointer
- type Proxy
- type Result
- type Trace
- type TraceItem
Constants ¶
View Source
const (
AOPErrorNamespace = "AOP"
)
Variables ¶
View Source
var ( ErrBeanInstanceIsNil = errors.TN(AOPErrorNamespace, 1, "aop error namespace is nil, id: {{.id}}") ErrBeanIsNotAnPtr = errors.TN(AOPErrorNamespace, 2, "bean should be an ptr, id: {{.id}}") ErrBeanAlreadyRegistered = errors.TN(AOPErrorNamespace, 3, "bean already regitered, id: {{.id}}") ErrBeanIDShouldNotBeEmpty = errors.TN(AOPErrorNamespace, 4, "bean id should not be empty") ErrBeanNotExist = errors.TN(AOPErrorNamespace, 5, "bean not exist, id: {{.id}}") ErrAspectIDShouldNotBeEmpty = errors.TN(AOPErrorNamespace, 6, "aspect id should not be empty") ErrBeanMethodNotExit = errors.TN(AOPErrorNamespace, 7, "bean method not exist, id: {{.id}}, class: {{.class}}, method: {{.method}}") ErrWrongAdviceFuncArgsNum = errors.TN(AOPErrorNamespace, 8, "wrong advice func args number, id: {{.id}}, class: {{.class}}, method: {{.method}}") ErrEndInvokeParamsIsNotFunc = errors.TN(AOPErrorNamespace, 9, "en invoke params is not func, bean id: {{.id}}, method: {{.method}}") ErrWrongEndInvokeFuncArgsNum = errors.TN(AOPErrorNamespace, 10, "wrong end invoke func args number, bean id: {{.id}}, method: {{.method}}") ErrInvokeParamsIsNotFunc = errors.TN(AOPErrorNamespace, 11, "invoke params is not func, bean id: {{.id}}, method: {{.method}}") ErrWrongInvokeFuncArgsNum = errors.TN(AOPErrorNamespace, 12, "wrong invoke func args number, bean id: {{.id}}, method: {{.method}}") ErrInvokeFuncNotExist = errors.TN(AOPErrorNamespace, 13, "invoke func not exist, bean id: {{.id}}, method: {{.method}}") ErrInvokeFuncTypeError = errors.TN(AOPErrorNamespace, 14, "invoke func is not func type, bean id: {{.id}}, method: {{.method}}") ErrEndInvokeTwice = errors.TN(AOPErrorNamespace, 15, "end invoke twice, bean id: {{.id}}, method: {{.method}}") ErrBadInvokeMethodType = errors.TN(AOPErrorNamespace, 16, "invoke method params should be func name or func type") ErrPointcutNotExist = errors.TN(AOPErrorNamespace, 17, "pointcut no exist, pointcut id: {{.id}}") ErrMethodIsNil = errors.TN(AOPErrorNamespace, 18, "method is nil") ErrBadMethodType = errors.TN(AOPErrorNamespace, 19, "method type error") ErrBadPointcutExpr = errors.TN(AOPErrorNamespace, 20, "bad pointcut expression, expression: {{.expr}}") ErrEmptyPointcutRefID = errors.TN(AOPErrorNamespace, 21, "pointcut ref id is empty") ErrExecExpressionAlreadySet = errors.TN(AOPErrorNamespace, 22, "execution expression already set at pointcut {{.id}}, old expr is: {{.expr}}") ErrTracAlreadyStarted = errors.TN(AOPErrorNamespace, 23, "trace already started") ErrTracNotStarted = errors.TN(AOPErrorNamespace, 24, "trace not started") ErrUnknownJoinPointArgType = errors.TN(AOPErrorNamespace, 25, "unknown advice func arg type, bean id: {{.id}}, method: {{.method}}, pointcut {{.refID}}") ErrJoinPointArgsUsage = errors.TN(AOPErrorNamespace, 26, "only AfterReturning could have aop.Result argument, bean id: {{.id}}, method: {{.method}}, pointcut {{.refID}}") ErrMapperArgShouldBeFunc = errors.TN(AOPErrorNamespace, 27, "result map to arg should be a func") ErrWrongMapFuncArgsNum = errors.TN(AOPErrorNamespace, 28, "wrong end invoke func args number") )
Functions ¶
func StartTrace ¶
func StartTrace() (err error)
Types ¶
type AOP ¶
type AOP struct {
// contains filtered or unexported fields
}
func (*AOP) SetBeanFactory ¶
func (p *AOP) SetBeanFactory(factory BeanFactory)
type Advice ¶
type Advice struct { Ordering AdviceOrdering Method string Pointcut string PointcutRefID string // contains filtered or unexported fields }
type AdviceOrdering ¶
type AdviceOrdering int
const ( Before AdviceOrdering = 1 After AdviceOrdering = 2 AfterReturning AdviceOrdering = 3 AfterError AdviceOrdering = 4 AfterPanic AdviceOrdering = 5 Around AdviceOrdering = 6 )
type Aspect ¶
type Aspect struct {
// contains filtered or unexported fields
}
func (*Aspect) AddPointcut ¶
func (*Aspect) GetMatchedAdvices ¶
func (*Aspect) SetBeanFactory ¶
func (p *Aspect) SetBeanFactory(factory BeanFactory)
type BeanFactory ¶
type BeanFactory interface { RegisterBean(id string, value interface{}) BeanFactory GetBean(id string) (bean *Bean, err error) }
func NewClassicBeanFactory ¶
func NewClassicBeanFactory() BeanFactory
type BeanFactoryAware ¶
type BeanFactoryAware interface {
SetBeanFactory(factory BeanFactory)
}
type ClassicBeanFactory ¶
type ClassicBeanFactory struct {
// contains filtered or unexported fields
}
func (*ClassicBeanFactory) GetBean ¶
func (p *ClassicBeanFactory) GetBean(id string) (bean *Bean, err error)
func (*ClassicBeanFactory) RegisterBean ¶
func (p *ClassicBeanFactory) RegisterBean(id string, beanInstance interface{}) (factory BeanFactory)
type InvokeResult ¶
type InvokeResult struct {
// contains filtered or unexported fields
}
func (*InvokeResult) BeanID ¶
func (p *InvokeResult) BeanID() string
func (*InvokeResult) End ¶
func (p *InvokeResult) End(callback ...interface{}) (err error)
func (*InvokeResult) Error ¶
func (p *InvokeResult) Error() error
func (*InvokeResult) MethodName ¶
func (p *InvokeResult) MethodName() string
type JoinPointer ¶
type MethodMetadata ¶
type Pointcut ¶
type Pointcut struct {
// contains filtered or unexported fields
}
func NewPointcut ¶
func (*Pointcut) NotExecution ¶
type ProceedingJoinPoint ¶
type ProceedingJoinPoint struct { JoinPointer // contains filtered or unexported fields }
func (*ProceedingJoinPoint) Args ¶
func (p *ProceedingJoinPoint) Args() Args
func (*ProceedingJoinPoint) Proceed ¶
func (p *ProceedingJoinPoint) Proceed(args ...interface{}) (result Result)
func (*ProceedingJoinPoint) Target ¶
func (p *ProceedingJoinPoint) Target() *Bean
type ProceedingJoinPointer ¶
type ProceedingJoinPointer interface { JoinPointer Proceed(args ...interface{}) Result }
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) Invoke ¶
func (p *Proxy) Invoke(method interface{}, args ...interface{}) (result *InvokeResult)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.