我正在模拟一个方法调用,如下所示:
tctx.someMock.On("addProd",
product.NewAddProductParamsWithContext(ctx).
WithID("someid").
WithCreateRequest(pro.CreateProdBody{
creationDate: "someDate" ,
}), nil).
Return(nil, nil)
效果很好。
现在,在这里,不是为 field 传递一个固定值creationDate
,如果我想概括它以便它适用于传递的任何值,我该如何实现呢?我对 Go 很陌生,所以不知道该怎么做
creationDate 的值可以是任何值,例如 -2021-03-19T18:57:16.589Z
或2022-04-23T14:17:56.589Z
等等。我只是不想限制模拟调用为 creationDate 的固定值工作,但我希望它适用于传递的任何日期字符串