Documentation
¶
Index ¶
- type Patch
- func PatchInstanceMethodByName(target reflect.Type, methodName string, redirection interface{}) (*Patch, error)
- func PatchMethod(target, redirection interface{}) (*Patch, error)
- func PatchMethodByReflect(target reflect.Method, redirection interface{}) (*Patch, error)
- func PatchMethodByReflectValue(target reflect.Value, redirection interface{}) (*Patch, error)
- func PatchMethodWithMakeFunc(target reflect.Method, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error)
- func PatchMethodWithMakeFuncValue(target reflect.Value, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Patch ¶
type Patch struct {
// contains filtered or unexported fields
}
func PatchInstanceMethodByName ¶
func PatchInstanceMethodByName(target reflect.Type, methodName string, redirection interface{}) (*Patch, error)
Patches an instance func by using two parameters, the target struct type and the method name inside that type, this func will be redirected to the "redirection" func. Note: The first parameter of the redirection func must be the object instance.
func PatchMethod ¶
Patches a target func to redirect calls to "redirection" func. Both function must have same arguments and return types.
func PatchMethodByReflect ¶
Patches a target func by passing the reflect.Method of the func. The target func will be redirected to the "redirection" func. Both function must have same arguments and return types.
func PatchMethodByReflectValue ¶ added in v1.0.5
Patches a target func by passing the reflect.ValueOf of the func. The target func will be redirected to the "redirection" func. Both function must have same arguments and return types.
func PatchMethodWithMakeFunc ¶
func PatchMethodWithMakeFunc(target reflect.Method, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error)
Patches a target func with a "redirection" function created at runtime by using "reflect.MakeFunc".
func PatchMethodWithMakeFuncValue ¶ added in v1.0.5
func PatchMethodWithMakeFuncValue(target reflect.Value, fn func(args []reflect.Value) (results []reflect.Value)) (*Patch, error)
Patches a target func with a "redirection" function created at runtime by using "reflect.MakeFunc".