MCPcopy
hub / github.com/ugorji/go / CodecEncodeSelf

Method CodecEncodeSelf

codec/values_codecgen_generated_test.go:6725–6802  ·  view source on GitHub ↗
(e *Encoder)

Source from the content-addressed store, hash-verified

6723
6724func (codecgenC) codecSelferViaCodecgen() {}
6725func (x *codecgenC) CodecEncodeSelf(e *Encoder) {
6726 var h codecSelfer19780
6727 z, r := GenHelper().Encoder(e)
6728 _, _, _ = h, z, r
6729 if z.EncBasicHandle().CheckCircularRef {
6730 z.EncEncode(x)
6731 return
6732 }
6733 if x == nil {
6734 r.EncodeNil()
6735 } else {
6736 yy2arr2 := z.EncBasicHandle().StructToArray
6737 _ = yy2arr2
6738 const yyr2 bool = false // struct tag has 'toArray'
6739 var yyq2 = [1]bool{ // should field at this index be written?
6740 !(x.BB.IsCodecEmpty()), // BB
6741 }
6742 _ = yyq2
6743 if yyr2 || yy2arr2 {
6744 z.EncWriteArrayStart(1)
6745 z.EncWriteArrayElem()
6746 if yyq2[0] {
6747 yy4 := &x.BB
6748 if yyxt5 := z.Extension(yy4); yyxt5 != nil {
6749 z.EncExtension(yy4, yyxt5)
6750 } else {
6751 yy4.CodecEncodeSelf(e)
6752 }
6753 } else {
6754 r.EncodeNil()
6755 }
6756 z.EncWriteArrayEnd()
6757 } else {
6758 var yynn2 int
6759 for _, b := range yyq2 {
6760 if b {
6761 yynn2++
6762 }
6763 }
6764 z.EncWriteMapStart(yynn2)
6765 yynn2 = 0
6766 if z.EncBasicHandle().Canonical {
6767 if yyq2[0] {
6768 z.EncWriteMapElemKey()
6769 if z.IsJSONHandle() {
6770 z.EncWr().WriteStr("\"BB\"")
6771 } else {
6772 r.EncodeString(`BB`)
6773 }
6774 z.EncWriteMapElemValue()
6775 yy6 := &x.BB
6776 if yyxt7 := z.Extension(yy6); yyxt7 != nil {
6777 z.EncExtension(yy6, yyxt7)
6778 } else {
6779 yy6.CodecEncodeSelf(e)
6780 }
6781 }
6782 } else {

Callers

nothing calls this directly

Calls 15

GenHelperFunction · 0.85
EncoderMethod · 0.80
EncBasicHandleMethod · 0.80
EncEncodeMethod · 0.80
EncWriteArrayStartMethod · 0.80
EncWriteArrayElemMethod · 0.80
EncExtensionMethod · 0.80
EncWriteArrayEndMethod · 0.80
EncWriteMapStartMethod · 0.80
EncWriteMapElemKeyMethod · 0.80
WriteStrMethod · 0.80
EncWrMethod · 0.80

Tested by

no test coverage detected