Example #1
0
func decodeEntry(key, value []byte) Entry {
	switch *coding {

	case "text":
		return Entry{
			Key:   string(key),
			Value: string(value),
		}
	case "mspack":
		var v interface{}

		err := msgpack.Unmarshal(value, &v)
		if err != nil {
			log.Println(err)
		}

		switch value := v.(type) {

		case map[interface{}]interface{}:
			v = toStringMap(value)
		}

		b, err := json.Marshal(v)
		if err != nil {
			log.Println(err)
		}

		return Entry{
			Key:   string(key),
			Value: string(b),
		}
	}

	return Entry{}
}
Example #2
0
func (MsgPackSerializer) Decode(data []byte, result interface{}) error {
	return msgpack.Unmarshal(data, result)
}
Example #3
0
func fnVMsgpackDecodeFn(buf []byte, ts interface{}) error {
	return vmsgpack.Unmarshal(buf, ts)
}
Example #4
0
func (c msgpackCodec) Decode(b []byte, v interface{}) error {
	return msgpack.Unmarshal(b, v)
}
func (m VmihailencoMsgpackSerializer) Unmarshal(d []byte, o interface{}) error {
	return vmihailenco.Unmarshal(d, o)
}