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

Method CodecEncodeSelf

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

Source from the content-addressed store, hash-verified

1202
1203func (testSimpleFields) codecSelferViaCodecgen() {}
1204func (x *testSimpleFields) CodecEncodeSelf(e *Encoder) {
1205 var h codecSelfer19780
1206 z, r := GenHelper().Encoder(e)
1207 _, _, _ = h, z, r
1208 if z.EncBasicHandle().CheckCircularRef {
1209 z.EncEncode(x)
1210 return
1211 }
1212 if x == nil {
1213 r.EncodeNil()
1214 } else {
1215 yy2arr2 := z.EncBasicHandle().StructToArray
1216 _ = yy2arr2
1217 const yyr2 bool = false // struct tag has 'toArray'
1218 if yyr2 || yy2arr2 {
1219 z.EncWriteArrayStart(17)
1220 z.EncWriteArrayElem()
1221 r.EncodeString(string(x.S))
1222 z.EncWriteArrayElem()
1223 r.EncodeInt(int64(x.I64))
1224 z.EncWriteArrayElem()
1225 r.EncodeInt(int64(x.I8))
1226 z.EncWriteArrayElem()
1227 r.EncodeUint(uint64(x.Ui64))
1228 z.EncWriteArrayElem()
1229 r.EncodeUint(uint64(x.Ui8))
1230 z.EncWriteArrayElem()
1231 r.EncodeFloat64(float64(x.F64))
1232 z.EncWriteArrayElem()
1233 r.EncodeFloat32(float32(x.F32))
1234 z.EncWriteArrayElem()
1235 r.EncodeBool(bool(x.B))
1236 z.EncWriteArrayElem()
1237 if x.Sslice == nil {
1238 r.EncodeNil()
1239 } else {
1240 z.F.EncSliceStringV(x.Sslice, e)
1241 } // end block: if x.Sslice slice == nil
1242 z.EncWriteArrayElem()
1243 if x.I32slice == nil {
1244 r.EncodeNil()
1245 } else {
1246 z.F.EncSliceInt32V(x.I32slice, e)
1247 } // end block: if x.I32slice slice == nil
1248 z.EncWriteArrayElem()
1249 if x.Ui64slice == nil {
1250 r.EncodeNil()
1251 } else {
1252 z.F.EncSliceUint64V(x.Ui64slice, e)
1253 } // end block: if x.Ui64slice slice == nil
1254 z.EncWriteArrayElem()
1255 if x.Ui8slice == nil {
1256 r.EncodeNil()
1257 } else {
1258 r.EncodeStringBytesRaw([]byte(x.Ui8slice))
1259 } // end block: if x.Ui8slice slice == nil
1260 z.EncWriteArrayElem()
1261 if x.Bslice == nil {

Callers

nothing calls this directly

Calls 15

encSlicePtrtoint64Method · 0.95
GenHelperFunction · 0.85
EncoderMethod · 0.80
EncBasicHandleMethod · 0.80
EncEncodeMethod · 0.80
EncWriteArrayStartMethod · 0.80
EncWriteArrayElemMethod · 0.80
EncSliceStringVMethod · 0.80
EncSliceInt32VMethod · 0.80
EncSliceUint64VMethod · 0.80
EncSliceBoolVMethod · 0.80
EncExtensionMethod · 0.80

Tested by

no test coverage detected