Esempio n. 1
0
// EncodeMsg implements msgp.Encodable
func (z *Payload) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 5
	// write "Sub"
	err = en.Append(0x85, 0xa3, 0x53, 0x75, 0x62)
	if err != nil {
		return err
	}
	err = z.Sub.EncodeMsg(en)
	if err != nil {
		return
	}
	// write "D"
	err = en.Append(0xa1, 0x44)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.D)))
	if err != nil {
		return
	}
	for xvk := range z.D {
		err = en.WriteString(z.D[xvk])
		if err != nil {
			return
		}
	}
	// write "E"
	err = en.Append(0xa1, 0x45)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.E)))
	if err != nil {
		return
	}
	for bzg := range z.E {
		err = en.WriteInt32(z.E[bzg])
		if err != nil {
			return
		}
	}
	// write "G"
	err = en.Append(0xa1, 0x47)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.G)))
	if err != nil {
		return
	}
	for bai := range z.G {
		err = en.WriteFloat64(z.G[bai])
		if err != nil {
			return
		}
	}
	// write "Blob"
	err = en.Append(0xa4, 0x42, 0x6c, 0x6f, 0x62)
	if err != nil {
		return err
	}
	err = en.WriteBytes(z.Blob)
	if err != nil {
		return
	}
	return
}
Esempio n. 2
0
// EncodeMsg implements msgp.Encodable
func (z *Subload) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "A"
	err = en.Append(0x83, 0xa1, 0x41)
	if err != nil {
		return err
	}
	err = en.WriteString(z.A)
	if err != nil {
		return
	}
	// write "B"
	err = en.Append(0xa1, 0x42)
	if err != nil {
		return err
	}
	err = en.WriteInt(z.B)
	if err != nil {
		return
	}
	// write "F"
	err = en.Append(0xa1, 0x46)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.F)))
	if err != nil {
		return
	}
	for cmr := range z.F {
		err = en.WriteFloat64(z.F[cmr])
		if err != nil {
			return
		}
	}
	return
}