I am trying to create a custom type with all the capabilities of a mapper, such as indexing and iteration, but with some additional function overloads. This doesn't seem to work and I get the "no such overload" error, probably because the "." operator looks for a field instead of calling into the receiver, but I wanted to confirm there is no way to do this.
The following is my custom type.
type User struct {
ref.TypeAdapter
context *vctx.VerifyContext
m map[string]interface{}
traits.Mapper
traits.Receiver
}
var (
UserType = types.NewTypeValue("User",
traits.ContainerType,
traits.IndexerType,
traits.IterableType,
traits.SizerType,
traits.ReceiverType)
)
In the constructor func, it just creates a new dynamic map (types.NewDynamicMap) and passes in the source map[string]interface{} into it. This is assigned to Mapper in the struct instance. So basically the struct hands off all mapper logic to the underlying Mapper instance.
Thanks for your help.