Somehow, at runtime, I am getting the following panic message, even if it appears to me the method is properly defined to the struct that implements that interface.
panic: interface conversion: schema.MerchantResultset
is not search.ResultsetInterface: missing method Add
This is the interface blueprint
type ResultsetInterface interface {
Init(string)
CacheSet(context.Context) error
CacheSetPart(context.Context, int) error
CacheGet(context.Context, string) error
Add(interface{})
AddResultset(interface{})
}
The following is the method that is reported missing during runtime, which is assigned to my struct MerchantResultset.
func (mr *MerchantResultset) Add(item interface{}) {
mr.Data = append(mr.Data, item.(Merchant))
}
I am somehow very puzzled trying to understand what is actually being needed here
Probably it’s because you are passing around a MerchantResultset
, but the Add
method is only defined for a pointer to that type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With