예제 #1
0
// DecodeMsg implements msgp.Decodable
func (z *KVs) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(KVs, xsz)
	}
	for cmr := range *z {
		var asz uint32
		asz, err = dc.ReadArrayHeader()
		if err != nil {
			return
		}
		if asz != 2 {
			err = msgp.ArrayError{Wanted: 2, Got: asz}
			return
		}
		for ajw := range (*z)[cmr] {
			{
				var tmp []byte
				tmp, err = dc.ReadBytes([]byte((*z)[cmr][ajw]))
				(*z)[cmr][ajw] = Binary(tmp)
			}
			if err != nil {
				return
			}
		}
	}
	return
}
예제 #2
0
// DecodeMsg implements msgp.Decodable
func (z *Binary) DecodeMsg(dc *msgp.Reader) (err error) {
	{
		var tmp []byte
		tmp, err = dc.ReadBytes([]byte((*z)))
		(*z) = Binary(tmp)
	}
	if err != nil {
		return
	}
	return
}
예제 #3
0
// DecodeMsg implements msgp.Decodable
func (z *Packet) 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 "type":
			z.pType, err = dc.ReadByte()
			if err != nil {
				return
			}
		case "id":
			z.id, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "event":
			z.eventName, err = dc.ReadString()
			if err != nil {
				return
			}
		case "payload":
			z.payload, err = dc.ReadBytes(z.payload)
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
예제 #4
0
// DecodeMsg implements msgp.Decodable
func (z *Weather) 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 "time":
			z.Time, err = dc.ReadTime()
			if err != nil {
				return
			}
		case "size":
			z.Size, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "type":
			z.Type, err = dc.ReadString()
			if err != nil {
				return
			}
		case "details":
			z.Details, err = dc.ReadBytes(z.Details)
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
예제 #5
0
// DecodeMsg implements msgp.Decodable
func (z *KV) DecodeMsg(dc *msgp.Reader) (err error) {
	var asz uint32
	asz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if asz != 2 {
		err = msgp.ArrayError{Wanted: 2, Got: asz}
		return
	}
	for xvk := range z {
		{
			var tmp []byte
			tmp, err = dc.ReadBytes([]byte(z[xvk]))
			z[xvk] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	return
}
예제 #6
0
// DecodeMsg implements msgp.Decodable
func (z *Ks) DecodeMsg(dc *msgp.Reader) (err error) {
	var xsz uint32
	xsz, err = dc.ReadArrayHeader()
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(Ks, xsz)
	}
	for jfb := range *z {
		{
			var tmp []byte
			tmp, err = dc.ReadBytes([]byte((*z)[jfb]))
			(*z)[jfb] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	return
}
예제 #7
0
// DecodeMsg implements msgp.Decodable
func (z *Message) 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 "body":
			z.Body, err = dc.ReadBytes(z.Body)
			if err != nil {
				return
			}
		case "meta":
			var msz uint32
			msz, err = dc.ReadMapHeader()
			if err != nil {
				return
			}
			if z.Meta == nil && msz > 0 {
				z.Meta = make(map[string]interface{}, msz)
			} else if len(z.Meta) > 0 {
				for key, _ := range z.Meta {
					delete(z.Meta, key)
				}
			}
			for msz > 0 {
				msz--
				var xvk string
				var bzg interface{}
				xvk, err = dc.ReadString()
				if err != nil {
					return
				}
				bzg, err = dc.ReadIntf()
				if err != nil {
					return
				}
				z.Meta[xvk] = bzg
			}
		case "ct":
			z.ContentType, err = dc.ReadString()
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}
예제 #8
0
// DecodeMsg implements msgp.Decodable
func (z *Incident) 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 "event_name":
			z.EventName, err = dc.ReadBytes(z.EventName)
			if err != nil {
				return
			}
		case "time":
			z.Time, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "id":
			z.Id, err = dc.ReadInt64()
			if err != nil {
				return
			}
		case "active":
			z.Active, err = dc.ReadBool()
			if err != nil {
				return
			}
		case "escalation":
			z.Escalation, err = dc.ReadString()
			if err != nil {
				return
			}
		case "description":
			z.Description, err = dc.ReadString()
			if err != nil {
				return
			}
		case "policy":
			z.Policy, err = dc.ReadString()
			if err != nil {
				return
			}
		case "Status":
			z.Status, err = dc.ReadInt()
			if err != nil {
				return
			}
		case "Event":
			err = z.Event.DecodeMsg(dc)
			if err != nil {
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				return
			}
		}
	}
	return
}