summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vmihailenco/msgpack/v5/msgpack.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vmihailenco/msgpack/v5/msgpack.go')
-rw-r--r--vendor/github.com/vmihailenco/msgpack/v5/msgpack.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/github.com/vmihailenco/msgpack/v5/msgpack.go b/vendor/github.com/vmihailenco/msgpack/v5/msgpack.go
new file mode 100644
index 00000000..4db2fa2c
--- /dev/null
+++ b/vendor/github.com/vmihailenco/msgpack/v5/msgpack.go
@@ -0,0 +1,52 @@
+package msgpack
+
+import "fmt"
+
+type Marshaler interface {
+ MarshalMsgpack() ([]byte, error)
+}
+
+type Unmarshaler interface {
+ UnmarshalMsgpack([]byte) error
+}
+
+type CustomEncoder interface {
+ EncodeMsgpack(*Encoder) error
+}
+
+type CustomDecoder interface {
+ DecodeMsgpack(*Decoder) error
+}
+
+//------------------------------------------------------------------------------
+
+type RawMessage []byte
+
+var (
+ _ CustomEncoder = (RawMessage)(nil)
+ _ CustomDecoder = (*RawMessage)(nil)
+)
+
+func (m RawMessage) EncodeMsgpack(enc *Encoder) error {
+ return enc.write(m)
+}
+
+func (m *RawMessage) DecodeMsgpack(dec *Decoder) error {
+ msg, err := dec.DecodeRaw()
+ if err != nil {
+ return err
+ }
+ *m = msg
+ return nil
+}
+
+//------------------------------------------------------------------------------
+
+type unexpectedCodeError struct {
+ code byte
+ hint string
+}
+
+func (err unexpectedCodeError) Error() string {
+ return fmt.Sprintf("msgpack: unexpected code=%x decoding %s", err.code, err.hint)
+}