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

Method CodecEncodeSelf

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

Source from the content-addressed store, hash-verified

6460
6461func (codecgenA) codecSelferViaCodecgen() {}
6462func (x *codecgenA) CodecEncodeSelf(e *Encoder) {
6463 var h codecSelfer19780
6464 z, r := GenHelper().Encoder(e)
6465 _, _, _ = h, z, r
6466 if z.EncBasicHandle().CheckCircularRef {
6467 z.EncEncode(x)
6468 return
6469 }
6470 if x == nil {
6471 r.EncodeNil()
6472 } else {
6473 yy2arr2 := z.EncBasicHandle().StructToArray
6474 _ = yy2arr2
6475 const yyr2 bool = false // struct tag has 'toArray'
6476 if yyr2 || yy2arr2 {
6477 z.EncWriteArrayStart(1)
6478 z.EncWriteArrayElem()
6479 if x.ZZ == nil {
6480 r.EncodeNil()
6481 } else {
6482 r.EncodeStringBytesRaw([]byte(x.ZZ))
6483 } // end block: if x.ZZ slice == nil
6484 z.EncWriteArrayEnd()
6485 } else {
6486 z.EncWriteMapStart(1)
6487 if z.EncBasicHandle().Canonical {
6488 z.EncWriteMapElemKey()
6489 if z.IsJSONHandle() {
6490 z.EncWr().WriteStr("\"ZZ\"")
6491 } else {
6492 r.EncodeString(`ZZ`)
6493 }
6494 z.EncWriteMapElemValue()
6495 if x.ZZ == nil {
6496 r.EncodeNil()
6497 } else {
6498 r.EncodeStringBytesRaw([]byte(x.ZZ))
6499 } // end block: if x.ZZ slice == nil
6500 } else {
6501 z.EncWriteMapElemKey()
6502 if z.IsJSONHandle() {
6503 z.EncWr().WriteStr("\"ZZ\"")
6504 } else {
6505 r.EncodeString(`ZZ`)
6506 }
6507 z.EncWriteMapElemValue()
6508 if x.ZZ == nil {
6509 r.EncodeNil()
6510 } else {
6511 r.EncodeStringBytesRaw([]byte(x.ZZ))
6512 } // end block: if x.ZZ slice == nil
6513 }
6514 z.EncWriteMapEnd()
6515 }
6516 }
6517}
6518
6519func (x *codecgenA) CodecDecodeSelf(d *Decoder) {

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
EncWriteArrayEndMethod · 0.80
EncWriteMapStartMethod · 0.80
EncWriteMapElemKeyMethod · 0.80
WriteStrMethod · 0.80
EncWrMethod · 0.80
EncWriteMapElemValueMethod · 0.80

Tested by

no test coverage detected