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

Method CodecEncodeSelf

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

Source from the content-addressed store, hash-verified

6586
6587func (codecgenB) codecSelferViaCodecgen() {}
6588func (x *codecgenB) CodecEncodeSelf(e *Encoder) {
6589 var h codecSelfer19780
6590 z, r := GenHelper().Encoder(e)
6591 _, _, _ = h, z, r
6592 if z.EncBasicHandle().CheckCircularRef {
6593 z.EncEncode(x)
6594 return
6595 }
6596 if x == nil {
6597 r.EncodeNil()
6598 } else {
6599 yy2arr2 := z.EncBasicHandle().StructToArray
6600 _ = yy2arr2
6601 const yyr2 bool = false // struct tag has 'toArray'
6602 if yyr2 || yy2arr2 {
6603 z.EncWriteArrayStart(1)
6604 z.EncWriteArrayElem()
6605 yy4 := &x.AA
6606 if yyxt5 := z.Extension(yy4); yyxt5 != nil {
6607 z.EncExtension(yy4, yyxt5)
6608 } else {
6609 yy4.CodecEncodeSelf(e)
6610 }
6611 z.EncWriteArrayEnd()
6612 } else {
6613 z.EncWriteMapStart(1)
6614 if z.EncBasicHandle().Canonical {
6615 z.EncWriteMapElemKey()
6616 if z.IsJSONHandle() {
6617 z.EncWr().WriteStr("\"AA\"")
6618 } else {
6619 r.EncodeString(`AA`)
6620 }
6621 z.EncWriteMapElemValue()
6622 yy6 := &x.AA
6623 if yyxt7 := z.Extension(yy6); yyxt7 != nil {
6624 z.EncExtension(yy6, yyxt7)
6625 } else {
6626 yy6.CodecEncodeSelf(e)
6627 }
6628 } else {
6629 z.EncWriteMapElemKey()
6630 if z.IsJSONHandle() {
6631 z.EncWr().WriteStr("\"AA\"")
6632 } else {
6633 r.EncodeString(`AA`)
6634 }
6635 z.EncWriteMapElemValue()
6636 yy8 := &x.AA
6637 if yyxt9 := z.Extension(yy8); yyxt9 != nil {
6638 z.EncExtension(yy8, yyxt9)
6639 } else {
6640 yy8.CodecEncodeSelf(e)
6641 }
6642 }
6643 z.EncWriteMapEnd()
6644 }
6645 }

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