コード例 #1
0
ファイル: msgpack_gen.go プロジェクト: tartavull/dvid
// UnmarshalMsg implements msgp.Unmarshaler
func (z *KVs) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var xsz uint32
	xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(KVs, xsz)
	}
	for cua := range *z {
		var asz uint32
		asz, bts, err = msgp.ReadArrayHeaderBytes(bts)
		if err != nil {
			return
		}
		if asz != 2 {
			err = msgp.ArrayError{Wanted: 2, Got: asz}
			return
		}
		for xhx := range (*z)[cua] {
			{
				var tmp []byte
				tmp, bts, err = msgp.ReadBytesBytes(bts, []byte((*z)[cua][xhx]))
				(*z)[cua][xhx] = Binary(tmp)
			}
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #2
0
ファイル: node_gen.go プロジェクト: jim3mar/go-datastructures
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Key) 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 "u":
			{
				var tmp []byte
				tmp, bts, err = msgp.ReadBytesBytes(bts, []byte(z.UUID))
				z.UUID = ID(tmp)
			}
			if err != nil {
				return
			}
		case "v":
			z.Value, bts, err = msgp.ReadIntfBytes(bts)
			if err != nil {
				return
			}
		case "p":
			z.Payload, bts, err = msgp.ReadBytesBytes(bts, z.Payload)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #3
0
ファイル: msgpack_gen.go プロジェクト: tartavull/dvid
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Binary) UnmarshalMsg(bts []byte) (o []byte, err error) {
	{
		var tmp []byte
		tmp, bts, err = msgp.ReadBytesBytes(bts, []byte((*z)))
		(*z) = Binary(tmp)
	}
	if err != nil {
		return
	}
	o = bts
	return
}
コード例 #4
0
ファイル: packet_gen.go プロジェクト: ZloyDyadka/socketcrutch
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Packet) 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 "type":
			z.pType, bts, err = msgp.ReadByteBytes(bts)
			if err != nil {
				return
			}
		case "id":
			z.id, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				return
			}
		case "event":
			z.eventName, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "payload":
			z.payload, bts, err = msgp.ReadBytesBytes(bts, z.payload)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #5
0
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Weather) 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 "time":
			z.Time, bts, err = msgp.ReadTimeBytes(bts)
			if err != nil {
				return
			}
		case "size":
			z.Size, bts, err = msgp.ReadInt64Bytes(bts)
			if err != nil {
				return
			}
		case "type":
			z.Type, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "details":
			z.Details, bts, err = msgp.ReadBytesBytes(bts, z.Details)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #6
0
ファイル: msgpack_gen.go プロジェクト: tartavull/dvid
// UnmarshalMsg implements msgp.Unmarshaler
func (z *KV) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var asz uint32
	asz, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		return
	}
	if asz != 2 {
		err = msgp.ArrayError{Wanted: 2, Got: asz}
		return
	}
	for xvk := range z {
		{
			var tmp []byte
			tmp, bts, err = msgp.ReadBytesBytes(bts, []byte(z[xvk]))
			z[xvk] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	o = bts
	return
}
コード例 #7
0
ファイル: msgpack_gen.go プロジェクト: tartavull/dvid
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Ks) UnmarshalMsg(bts []byte) (o []byte, err error) {
	var xsz uint32
	xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
	if err != nil {
		return
	}
	if cap((*z)) >= int(xsz) {
		(*z) = (*z)[:xsz]
	} else {
		(*z) = make(Ks, xsz)
	}
	for eff := range *z {
		{
			var tmp []byte
			tmp, bts, err = msgp.ReadBytesBytes(bts, []byte((*z)[eff]))
			(*z)[eff] = Binary(tmp)
		}
		if err != nil {
			return
		}
	}
	o = bts
	return
}
コード例 #8
0
ファイル: file_test.go プロジェクト: jfbus/msgp
func (r *rawBytes) UnmarshalMsg(b []byte) ([]byte, error) {
	tmp, out, err := msgp.ReadBytesBytes(b, (*(*[]byte)(r))[:0])
	*r = rawBytes(tmp)
	return out, err
}
コード例 #9
0
ファイル: message_gen.go プロジェクト: jmptrader/pluq
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Message) 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 "body":
			z.Body, bts, err = msgp.ReadBytesBytes(bts, z.Body)
			if err != nil {
				return
			}
		case "meta":
			var msz uint32
			msz, bts, err = msgp.ReadMapHeaderBytes(bts)
			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 {
				var xvk string
				var bzg interface{}
				msz--
				xvk, bts, err = msgp.ReadStringBytes(bts)
				if err != nil {
					return
				}
				bzg, bts, err = msgp.ReadIntfBytes(bts)
				if err != nil {
					return
				}
				z.Meta[xvk] = bzg
			}
		case "ct":
			z.ContentType, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #10
0
ファイル: node_gen.go プロジェクト: jim3mar/go-datastructures
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Node) 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 "id":
			{
				var tmp []byte
				tmp, bts, err = msgp.ReadBytesBytes(bts, []byte(z.ID))
				z.ID = ID(tmp)
			}
			if err != nil {
				return
			}
		case "il":
			z.IsLeaf, bts, err = msgp.ReadBoolBytes(bts)
			if err != nil {
				return
			}
		case "cv":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.ChildValues) >= int(xsz) {
				z.ChildValues = z.ChildValues[:xsz]
			} else {
				z.ChildValues = make([]interface{}, xsz)
			}
			for cmr := range z.ChildValues {
				z.ChildValues[cmr], bts, err = msgp.ReadIntfBytes(bts)
				if err != nil {
					return
				}
			}
		case "ck":
			var xsz uint32
			xsz, bts, err = msgp.ReadArrayHeaderBytes(bts)
			if err != nil {
				return
			}
			if cap(z.ChildKeys) >= int(xsz) {
				z.ChildKeys = z.ChildKeys[:xsz]
			} else {
				z.ChildKeys = make(Keys, xsz)
			}
			for ajw := range z.ChildKeys {
				if msgp.IsNil(bts) {
					bts, err = msgp.ReadNilBytes(bts)
					if err != nil {
						return
					}
					z.ChildKeys[ajw] = nil
				} else {
					if z.ChildKeys[ajw] == nil {
						z.ChildKeys[ajw] = new(Key)
					}
					bts, err = z.ChildKeys[ajw].UnmarshalMsg(bts)
					if err != nil {
						return
					}
				}
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}
コード例 #11
0
ファイル: incident_gen.go プロジェクト: postfix/bangarang
// UnmarshalMsg implements msgp.Unmarshaler
func (z *Incident) 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 "event_name":
			z.EventName, bts, err = msgp.ReadBytesBytes(bts, z.EventName)
			if err != nil {
				return
			}
		case "time":
			z.Time, bts, err = msgp.ReadInt64Bytes(bts)
			if err != nil {
				return
			}
		case "id":
			z.Id, bts, err = msgp.ReadInt64Bytes(bts)
			if err != nil {
				return
			}
		case "active":
			z.Active, bts, err = msgp.ReadBoolBytes(bts)
			if err != nil {
				return
			}
		case "escalation":
			z.Escalation, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "description":
			z.Description, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "policy":
			z.Policy, bts, err = msgp.ReadStringBytes(bts)
			if err != nil {
				return
			}
		case "Status":
			z.Status, bts, err = msgp.ReadIntBytes(bts)
			if err != nil {
				return
			}
		case "Event":
			bts, err = z.Event.UnmarshalMsg(bts)
			if err != nil {
				return
			}
		default:
			bts, err = msgp.Skip(bts)
			if err != nil {
				return
			}
		}
	}
	o = bts
	return
}