示例#1
0
文件: rmq_gen.go 项目: go-binder/rmq
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Subload) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "A":
			z.A, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "B":
			z.B, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				return
			}
		case "F":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.F) >= int(xsz) {
				z.F = z.F[:xsz]
			} else {
				z.F = make([]float64, xsz)
			}
			for cmr := range z.F {
				z.F[cmr], bts, err = msgp.ReadFloat64Bytes(bts)
				if err != nil {
					return
				}
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
示例#2
0
文件: rmq_gen.go 项目: go-binder/rmq
// DecodeMsg implements msgp.Decodable
func (z *Subload) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "A":
			z.A, err = dc.ReadString()
			if err != nil {
				return
			}
		case "B":
			z.B, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "F":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.F) >= int(xsz) {
				z.F = z.F[:xsz]
			} else {
				z.F = make([]float64, xsz)
			}
			for cmr := range z.F {
				z.F[cmr], err = dc.ReadFloat64()
				if err != nil {
					return
				}
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
示例#3
0
文件: rmq_gen.go 项目: go-binder/rmq
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Payload) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, bts, err = msgp.ReadMapHeaderBytes(bts)
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, bts, err = msgp.ReadMapKeyZC(bts)
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "Sub":
			bts, err = z.Sub.UnmarshalMsg(bts)
			if err != nil {
				return
			}
		case "D":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.D) >= int(xsz) {
				z.D = z.D[:xsz]
			} else {
				z.D = make([]string, xsz)
			}
			for xvk := range z.D {
				z.D[xvk], bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					return
				}
			}
		case "E":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.E) >= int(xsz) {
				z.E = z.E[:xsz]
			} else {
				z.E = make([]int32, xsz)
			}
			for bzg := range z.E {
				z.E[bzg], bts, err = msgp.ReadInt32Bytes(bts)
				if err != nil {
					return
				}
			}
		case "G":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.G) >= int(xsz) {
				z.G = z.G[:xsz]
			} else {
				z.G = make([]float64, xsz)
			}
			for bai := range z.G {
				z.G[bai], bts, err = msgp.ReadFloat64Bytes(bts)
				if err != nil {
					return
				}
			}
		case "Blob":
			z.Blob, bts, err = msgp.ReadBytesBytes(bts, z.Blob)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
示例#4
0
文件: rmq_gen.go 项目: go-binder/rmq
// DecodeMsg implements msgp.Decodable
func (z *Payload) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var isz uint32
	isz, err = dc.ReadMapHeader()
	if err != nil {
		return
	}
	for isz > 0 {
		isz--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			return
		}
		switch msgp.UnsafeString(field) {
		case "Sub":
			err = z.Sub.DecodeMsg(dc)
			if err != nil {
				return
			}
		case "D":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.D) >= int(xsz) {
				z.D = z.D[:xsz]
			} else {
				z.D = make([]string, xsz)
			}
			for xvk := range z.D {
				z.D[xvk], err = dc.ReadString()
				if err != nil {
					return
				}
			}
		case "E":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.E) >= int(xsz) {
				z.E = z.E[:xsz]
			} else {
				z.E = make([]int32, xsz)
			}
			for bzg := range z.E {
				z.E[bzg], err = dc.ReadInt32()
				if err != nil {
					return
				}
			}
		case "G":
			var xsz uint32
			xsz, err = dc.ReadArrayHeader()
			if err != nil {
				return
			}
			if cap(z.G) >= int(xsz) {
				z.G = z.G[:xsz]
			} else {
				z.G = make([]float64, xsz)
			}
			for bai := range z.G {
				z.G[bai], err = dc.ReadFloat64()
				if err != nil {
					return
				}
			}
		case "Blob":
			z.Blob, err = dc.ReadBytes(z.Blob)
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}