Encode method for MessagePackCodec. It encodes the input value into a byte slice using MessagePack. Returns encoded byte slice or error.
(msg interface{})
| 68 | // Encode method for MessagePackCodec. It encodes the input value into a byte slice using MessagePack. |
| 69 | // Returns encoded byte slice or error. |
| 70 | func (m *MessagePackCodec) Encode(msg interface{}) ([]byte, error) { |
| 71 | var b []byte |
| 72 | err := codec.NewEncoderBytes(&b, m.MsgPack).Encode(msg) |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | return b, nil |
| 77 | } |
| 78 | |
| 79 | // Encode is a method for MessagePackCodecEncoder. |
| 80 | // It takes in msg of type interface{} as input, that is to be encoded. |
no outgoing calls