Пример #1
0
// EncodeMsg implements msgp.Encodable
func (z Binary) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteBytes([]byte(z))
	if err != nil {
		return
	}
	return
}
Пример #2
0
// EncodeMsg implements msgp.Encodable
func (z *KV) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(2)
	if err != nil {
		return
	}
	for xvk := range z {
		err = en.WriteBytes([]byte(z[xvk]))
		if err != nil {
			return
		}
	}
	return
}
Пример #3
0
// EncodeMsg implements msgp.Encodable
func (z Ks) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(uint32(len(z)))
	if err != nil {
		return
	}
	for cxo := range z {
		err = en.WriteBytes([]byte(z[cxo]))
		if err != nil {
			return
		}
	}
	return
}
Пример #4
0
// EncodeMsg implements msgp.Encodable
func (z KVs) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteArrayHeader(uint32(len(z)))
	if err != nil {
		return
	}
	for wht := range z {
		err = en.WriteArrayHeader(2)
		if err != nil {
			return
		}
		for hct := range z[wht] {
			err = en.WriteBytes([]byte(z[wht][hct]))
			if err != nil {
				return
			}
		}
	}
	return
}
Пример #5
0
// EncodeMsg implements msgp.Encodable
func (z *Message) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 3
	// write "body"
	err = en.Append(0x83, 0xa4, 0x62, 0x6f, 0x64, 0x79)
	if err != nil {
		return err
	}
	err = en.WriteBytes(z.Body)
	if err != nil {
		return
	}
	// write "meta"
	err = en.Append(0xa4, 0x6d, 0x65, 0x74, 0x61)
	if err != nil {
		return err
	}
	err = en.WriteMapHeader(uint32(len(z.Meta)))
	if err != nil {
		return
	}
	for xvk, bzg := range z.Meta {
		err = en.WriteString(xvk)
		if err != nil {
			return
		}
		err = en.WriteIntf(bzg)
		if err != nil {
			return
		}
	}
	// write "ct"
	err = en.Append(0xa2, 0x63, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteString(z.ContentType)
	if err != nil {
		return
	}
	return
}
Пример #6
0
// EncodeMsg implements msgp.Encodable
func (z *Packet) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "type"
	err = en.Append(0x84, 0xa4, 0x74, 0x79, 0x70, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteByte(z.pType)
	if err != nil {
		return
	}
	// write "id"
	err = en.Append(0xa2, 0x69, 0x64)
	if err != nil {
		return err
	}
	err = en.WriteInt(z.id)
	if err != nil {
		return
	}
	// write "event"
	err = en.Append(0xa5, 0x65, 0x76, 0x65, 0x6e, 0x74)
	if err != nil {
		return err
	}
	err = en.WriteString(z.eventName)
	if err != nil {
		return
	}
	// write "payload"
	err = en.Append(0xa7, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64)
	if err != nil {
		return err
	}
	err = en.WriteBytes(z.payload)
	if err != nil {
		return
	}
	return
}
Пример #7
0
// EncodeMsg implements msgp.Encodable
func (z *Weather) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "time"
	err = en.Append(0x84, 0xa4, 0x74, 0x69, 0x6d, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteTime(z.Time)
	if err != nil {
		return
	}
	// write "size"
	err = en.Append(0xa4, 0x73, 0x69, 0x7a, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteInt64(z.Size)
	if err != nil {
		return
	}
	// write "type"
	err = en.Append(0xa4, 0x74, 0x79, 0x70, 0x65)
	if err != nil {
		return err
	}
	err = en.WriteString(z.Type)
	if err != nil {
		return
	}
	// write "details"
	err = en.Append(0xa7, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73)
	if err != nil {
		return err
	}
	err = en.WriteBytes(z.Details)
	if err != nil {
		return
	}
	return
}
Пример #8
0
// EncodeMsg implements msgp.Encodable
func (z *Incident) EncodeMsg(en *msgp.Writer) (err error) {
	err = en.WriteMapHeader(9)
	if err != nil {
		return
	}
	err = en.WriteString("event_name")
	if err != nil {
		return
	}
	err = en.WriteBytes(z.EventName)
	if err != nil {
		return
	}
	err = en.WriteString("time")
	if err != nil {
		return
	}
	err = en.WriteInt64(z.Time)
	if err != nil {
		return
	}
	err = en.WriteString("id")
	if err != nil {
		return
	}
	err = en.WriteInt64(z.Id)
	if err != nil {
		return
	}
	err = en.WriteString("active")
	if err != nil {
		return
	}
	err = en.WriteBool(z.Active)
	if err != nil {
		return
	}
	err = en.WriteString("escalation")
	if err != nil {
		return
	}
	err = en.WriteString(z.Escalation)
	if err != nil {
		return
	}
	err = en.WriteString("description")
	if err != nil {
		return
	}
	err = en.WriteString(z.Description)
	if err != nil {
		return
	}
	err = en.WriteString("policy")
	if err != nil {
		return
	}
	err = en.WriteString(z.Policy)
	if err != nil {
		return
	}
	err = en.WriteString("Status")
	if err != nil {
		return
	}
	err = en.WriteInt(z.Status)
	if err != nil {
		return
	}
	err = en.WriteString("Event")
	if err != nil {
		return
	}
	err = z.Event.EncodeMsg(en)
	if err != nil {
		return
	}
	return
}