Link

BeyondContext

The cornerstone that will help you to build handy and useful advices.


API

BeyondContext provides us with methods to obtain all the information from the intercepted functions.

We can also make use of BeyondContext to share data between Before and Returning methods (It’s so useful when coding Around advices).

BeyondContext

Method Description
Pkg():string It returns the package path
Function():string It returns the name of the intercepted function
Type():interface{} It returns the value for the type that contains the intercepted method
Params():*Args It returns a pointer of Args
Results():*Args It returns a pointer of Args
Set(string,interface{}) It saves a value that is shareable along the advice cycle
Get(string):interface{} It obtains a value from the BeyondContext

Args

Method Description
ForEach(fn func(int, *Arg)) It exexutes the provided function for all the arguments
Find(func(int,Arg) bool) (int,Arg) It returns the first index and argument that match with the given function
Count() int It returns the number or arguments
At(index int) *Arg It returns the Arg int the given position
Get(name string):*Args It returns the Arg with the given name
Set(string,interface{}) It update the value for the Arg with the given name
SetAt(int,interface{}) It updates the value for the Arg in the given position

Arg

Method Description
Name():string It returns the name of the argument
Value():interface{} It returns the value of the argument
Kind():reflect.Type It returns the type of the argument