Documentation ¶
Index ¶
- func Set(v interface{}) gomock.Matcher
- func Version() string
- type Forwarder
- type OutValue
- type OutValues
- type Stub
- func Elem(target interface{}, index int, substitute interface{}) Stub
- func Field(target interface{}, index int, substitute interface{}) Stub
- func FieldByName(target interface{}, name string, substitute interface{}) Stub
- func FuncOuts(target interface{}, outs OutValues) Stub
- func Map(target interface{}, key interface{}, substitute interface{}) Stub
- func Method(target reflect.Value, method string, substitute Forwarder, outs OutValues) Stub
- func New(target interface{}) Stub
- func Path(target interface{}, path string, substitute interface{}) Stub
- func Var(target interface{}, substitute interface{}) Stub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Forwarder ¶
type Forwarder interface { // Set methodName 接口方法名,newFunc 新的将被回调的接口方法,originalTarget 原接口内部动态值。 Set(methodName string, newFunc interface{}, originalTarget interface{}) }
Forwarder 接口方法替换调用。
type Stub ¶
type Stub interface { // Var 替换单个变量。 Var(target interface{}, substitute interface{}) Stub // FuncOuts 替换函数变量以固定次数返回值代替。 FuncOuts(target interface{}, outs OutValues) Stub // FieldByName 替换结构体字段的值。 FieldByName(target interface{}, name string, substitute interface{}) Stub // Field 替换结构体字段的值。 Field(target interface{}, index int, substitute interface{}) Stub // Elem 替换切片或者数组的元素值。 Elem(target interface{}, index int, substitute interface{}) Stub // Map 替换映射中的某个键的值。 Map(target interface{}, key interface{}, substitute interface{}) Stub // Path 根据索引替换深层值。 Path(target interface{}, path string, substitute interface{}) Stub // PathByList 根据索引替换深层值。 PathByList(target interface{}, list []string, substitute interface{}) Stub // Method 替换接口变量的方法返回值。 Method(target reflect.Value, method string, substitute Forwarder, outs OutValues) Stub // FieldNext 沿用上次替换的 target,含义同上。 FieldNext(index int, substitute interface{}) Stub // FieldByNameNext 沿用上次替换的 target,含义同上。 FieldByNameNext(name string, substitute interface{}) Stub // ElemNext 沿用上次替换的 target,含义同上。 ElemNext(index int, substitute interface{}) Stub // MapNext 沿用上次替换的 target,含义同上。 MapNext(key interface{}, substitute interface{}) Stub // FieldFuncOutsNext 沿用上次替换的 target,含义同上。 FieldFuncOutsNext(index int, outs OutValues) Stub // FieldFuncOutsByNameNext 沿用上次替换的 target,含义同上。 FieldFuncOutsByNameNext(name string, outs OutValues) Stub // ToElem 打桩成 Elem。 ToElem(index int) Stub // ToField 打桩成字段。 ToField(index int) Stub // ToFieldByName 打桩成字段。 ToFieldByName(name string) Stub // ToMapVal 打桩成 map 值。 ToMapVal(key interface{}) Stub // Reset 还原该 stub 的所有替换值。 Reset() }
Stub 打桩对象能力定义。
func FieldByName ¶
FieldByName 替换结构体字段的值。
func Map ¶
func Map(target interface{}, key interface{}, substitute interface{}) Stub
Map 替换映射中的某个键的值。
Click to show internal directories.
Click to hide internal directories.