When I pass an isEmptyFuncfunction to RegisterTypeEncoderFunc, my isEmptyFuncis never called. My EncoderFuncfor the type does get called. Request is for the isEmptyFuncto be called.
My data looks like this, where TypeCis an array that can have empty bytes saved. When I use jsoniter.RegisterFieldEncoderFunc(reflect2.TypeOf(TypeB{}).String(), "TypeC", encodeB, isBEmpty), both encodeBand isBEmpty functions get called, but I lose the support for array type and can't parse out the empty []byte
type TypeA struct {
TypeB TypeB
}
type TypeB struct {
TypeC []TypeC `msgpack:"as_array" json:"omitempty"`
}
type TypeC []byte
func fun() {
jsoniter.RegisterTypeEncoderFunc(reflect2.TypeOf(TypeC{}).String(), encodeFunc, isEmptyFunc)
}
When I pass an
isEmptyFunc
function toRegisterTypeEncoderFunc
, myisEmptyFunc
is never called. MyEncoderFunc
for the type does get called. Request is for theisEmptyFunc
to be called.My data looks like this, where
TypeC
is an array that can have empty bytes saved. When I usejsoniter.RegisterFieldEncoderFunc(reflect2.TypeOf(TypeB{}).String(), "TypeC", encodeB, isBEmpty)
, bothencodeB
andisBEmpty
functions get called, but I lose the support for array type and can't parse out the empty []byte