コード例 #1
0
// EncodeMsg implements msgp.Encodable
func (z Person) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "Name"
	err = en.Append(0x83, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.Name)
	if err != nil {
		return
	}
	// write "Age"
	err = en.Append(0xa3, 0x41, 0x67, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteUint8(z.Age)
	if err != nil {
		return
	}
	// write "Height"
	err = en.Append(0xa6, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteFloat64(z.Height)
	if err != nil {
		return
	}
	return
}
コード例 #2
0
// EncodeMsg implements msgp.Encodable
func (z contype) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteUint8(uint8(z))
	if err != nil {
		return
	}
	return
}
コード例 #3
0
// EncodeMsg implements msgp.Encodable
func (z *A) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 6
	// write "Name"
	err = en.Append(0x86, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.Name)
	if err != nil {
		return
	}
	// write "BirthDay"
	err = en.Append(0xa8, 0x42, 0x69, 0x72, 0x74, 0x68, 0x44, 0x61, 0x79)
	if err != nil {
		return err
	}
	err = en.WriteInt64(z.BirthDay)
	if err != nil {
		return
	}
	// write "Phone"
	err = en.Append(0xa5, 0x50, 0x68, 0x6f, 0x6e, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.Phone)
	if err != nil {
		return
	}
	// write "Siblings"
	err = en.Append(0xa8, 0x53, 0x69, 0x62, 0x6c, 0x69, 0x6e, 0x67, 0x73)
	if err != nil {
		return err
	}
	err = en.WriteInt64(z.Siblings)
	if err != nil {
		return
	}
	// write "Spouse"
	err = en.Append(0xa6, 0x53, 0x70, 0x6f, 0x75, 0x73, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteUint8(z.Spouse)
	if err != nil {
		return
	}
	// write "Money"
	err = en.Append(0xa5, 0x4d, 0x6f, 0x6e, 0x65, 0x79)
	if err != nil {
		return err
	}
	err = en.WriteFloat64(z.Money)
	if err != nil {
		return
	}
	return
}
コード例 #4
0
// EncodeMsg implements msgp.Encodable
func (z *Group) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "Name"
	err = en.Append(0x82, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.Name)
	if err != nil {
		return
	}
	// write "Members"
	err = en.Append(0xa7, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.Members)))
	if err != nil {
		return
	}
	for xvk := range z.Members {
		// map header, size 3
		// write "Name"
		err = en.Append(0x83, 0xa4, 0x4e, 0x61, 0x6d, 0x65)
		if err != nil {
			return err
		}
		err = en.WriteString(z.Members[xvk].Name)
		if err != nil {
			return
		}
		// write "Age"
		err = en.Append(0xa3, 0x41, 0x67, 0x65)
		if err != nil {
			return err
		}
		err = en.WriteUint8(z.Members[xvk].Age)
		if err != nil {
			return
		}
		// write "Height"
		err = en.Append(0xa6, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74)
		if err != nil {
			return err
		}
		err = en.WriteFloat64(z.Members[xvk].Height)
		if err != nil {
			return
		}
	}
	return
}
コード例 #5
0
// EncodeMsg implements msgp.Encodable
func (z *containerSerz) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 2
	// write "t"
	err = en.Append(0x82, 0xa1, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteUint8(uint8(z.t))
	if err != nil {
		return
	}
	// write "r"
	err = en.Append(0xa1, 0x72)
	if err != nil {
		return err
	}
	err = z.r.EncodeMsg(en)
	if err != nil {
		return
	}
	return
}
コード例 #6
0
// EncodeMsg implements msgp.Encodable
func (z *roaringArray) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "keys"
	err = en.Append(0x84, 0xa4, 0x6b, 0x65, 0x79, 0x73)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.keys)))
	if err != nil {
		return
	}
	for zhct := range z.keys {
		err = en.WriteUint16(z.keys[zhct])
		if err != nil {
			return
		}
	}
	// write "needCopyOnWrite"
	err = en.Append(0xaf, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.needCopyOnWrite)))
	if err != nil {
		return
	}
	for zcua := range z.needCopyOnWrite {
		err = en.WriteBool(z.needCopyOnWrite[zcua])
		if err != nil {
			return
		}
	}
	// write "copyOnWrite"
	err = en.Append(0xab, 0x63, 0x6f, 0x70, 0x79, 0x4f, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteBool(z.copyOnWrite)
	if err != nil {
		return
	}
	// write "conserz"
	err = en.Append(0xa7, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x7a)
	if err != nil {
		return err
	}
	err = en.WriteArrayHeader(uint32(len(z.conserz)))
	if err != nil {
		return
	}
	for zxhx := range z.conserz {
		// map header, size 2
		// write "t"
		err = en.Append(0x82, 0xa1, 0x74)
		if err != nil {
			return err
		}
		err = en.WriteUint8(uint8(z.conserz[zxhx].t))
		if err != nil {
			return
		}
		// write "r"
		err = en.Append(0xa1, 0x72)
		if err != nil {
			return err
		}
		err = z.conserz[zxhx].r.EncodeMsg(en)
		if err != nil {
			return
		}
	}
	return
}