示例#1
0
func encodeEntry(value string) []byte {
	switch *coding {

	case "text":
		return []byte(value)
	case "mspack":
		var v interface{}

		err := json.Unmarshal([]byte(value), &v)
		if err != nil {
			log.Println(err)
		}

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

		return b
	}

	return nil
}
示例#2
0
func (MsgPackSerializer) Encode(data interface{}) ([]byte, error) {
	return msgpack.Marshal(data)
}
示例#3
0
func fnVMsgpackEncodeFn(ts interface{}) ([]byte, error) {
	return vmsgpack.Marshal(ts)
}
示例#4
0
文件: msgpack.go 项目: desertbit/pakt
func (c msgpackCodec) Encode(v interface{}) ([]byte, error) {
	return msgpack.Marshal(v)
}
func (m VmihailencoMsgpackSerializer) Marshal(o interface{}) []byte {
	d, _ := vmihailenco.Marshal(o)
	return d
}