MCPcopy Create free account
hub / github.com/buger/jsonparser / CodecEncodeSelf

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:727–783  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

725
726// Benchmark harness support for STK-REQ-004.
727func (x *CBGravatar) CodecEncodeSelf(e *codec1978.Encoder) {
728 var h codecSelfer6617
729 z, r := codec1978.GenHelperEncoder(e)
730 _, _, _ = h, z, r
731 if x == nil {
732 r.EncodeNil()
733 } else {
734 if false {
735 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
736 z.EncExtension(x, yyxt1)
737 } else if !z.EncBinary() && z.IsJSONHandle() {
738 z.EncJSONMarshal(x)
739 } else {
740 yysep2 := !z.EncBinary()
741 yy2arr2 := z.EncBasicHandle().StructToArray
742 _, _ = yysep2, yy2arr2
743 const yyr2 bool = false // struct tag has 'toArray'
744 if yyr2 || yy2arr2 {
745 r.WriteArrayStart(1)
746 } else {
747 r.WriteMapStart(1)
748 }
749 if yyr2 || yy2arr2 {
750 r.WriteArrayElem()
751 if x.Avatars == nil {
752 r.EncodeNil()
753 } else {
754 if false {
755 } else {
756 h.encSlicePtrtoCBAvatar(([]*CBAvatar)(x.Avatars), e)
757 }
758 }
759 } else {
760 r.WriteMapElemKey()
761 if z.IsJSONHandle() {
762 z.WriteStr("\"Avatars\"")
763 } else {
764 r.EncodeStringEnc(codecSelferCcUTF86617, `Avatars`)
765 }
766 r.WriteMapElemValue()
767 if x.Avatars == nil {
768 r.EncodeNil()
769 } else {
770 if false {
771 } else {
772 h.encSlicePtrtoCBAvatar(([]*CBAvatar)(x.Avatars), e)
773 }
774 }
775 }
776 if yyr2 || yy2arr2 {
777 r.WriteArrayEnd()
778 } else {
779 r.WriteMapEnd()
780 }
781 }
782 }
783}
784

Callers

nothing calls this directly

Calls 1

encSlicePtrtoCBAvatarMethod · 0.95

Tested by

no test coverage detected