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

Method CodecEncodeSelf

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

Source from the content-addressed store, hash-verified

6879
6880func (TestCodecgenG) codecSelferViaCodecgen() {}
6881func (x *TestCodecgenG) CodecEncodeSelf(e *Encoder) {
6882 var h codecSelfer19780
6883 z, r := GenHelper().Encoder(e)
6884 _, _, _ = h, z, r
6885 if z.EncBasicHandle().CheckCircularRef {
6886 z.EncEncode(x)
6887 return
6888 }
6889 if x == nil {
6890 r.EncodeNil()
6891 } else {
6892 yy2arr2 := z.EncBasicHandle().StructToArray
6893 _ = yy2arr2
6894 const yyr2 bool = false // struct tag has 'toArray'
6895 if yyr2 || yy2arr2 {
6896 z.EncWriteArrayStart(1)
6897 z.EncWriteArrayElem()
6898 r.EncodeInt(int64(x.TestCodecgenG))
6899 z.EncWriteArrayEnd()
6900 } else {
6901 z.EncWriteMapStart(1)
6902 if z.EncBasicHandle().Canonical {
6903 z.EncWriteMapElemKey()
6904 if z.IsJSONHandle() {
6905 z.EncWr().WriteStr("\"TestCodecgenG\"")
6906 } else {
6907 r.EncodeString(`TestCodecgenG`)
6908 }
6909 z.EncWriteMapElemValue()
6910 r.EncodeInt(int64(x.TestCodecgenG))
6911 } else {
6912 z.EncWriteMapElemKey()
6913 if z.IsJSONHandle() {
6914 z.EncWr().WriteStr("\"TestCodecgenG\"")
6915 } else {
6916 r.EncodeString(`TestCodecgenG`)
6917 }
6918 z.EncWriteMapElemValue()
6919 r.EncodeInt(int64(x.TestCodecgenG))
6920 }
6921 z.EncWriteMapEnd()
6922 }
6923 }
6924}
6925
6926func (x *TestCodecgenG) CodecDecodeSelf(d *Decoder) {
6927 var h codecSelfer19780

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