chore(deps): bump github.com/shamaton/msgpack/v2 from 2.2.0 to 2.2.2
Bumps [github.com/shamaton/msgpack/v2](https://github.com/shamaton/msgpack) from 2.2.0 to 2.2.2. - [Release notes](https://github.com/shamaton/msgpack/releases) - [Commits](https://github.com/shamaton/msgpack/compare/v2.2.0...v2.2.2) --- updated-dependencies: - dependency-name: github.com/shamaton/msgpack/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
54c8567697
commit
b3e5d80306
+39
-29
@@ -1,34 +1,44 @@
|
||||
package ext
|
||||
|
||||
import (
|
||||
"github.com/shamaton/msgpack/v2/internal/common"
|
||||
"io"
|
||||
"reflect"
|
||||
|
||||
"github.com/shamaton/msgpack/v2/internal/common"
|
||||
)
|
||||
|
||||
// StreamEncoder is interface that extended encoder should implement
|
||||
type StreamEncoder interface {
|
||||
Code() int8
|
||||
Type() reflect.Type
|
||||
Write(w io.Writer, value reflect.Value, buf *common.Buffer) error
|
||||
Write(w StreamWriter, value reflect.Value) error
|
||||
}
|
||||
|
||||
type StreamEncoderCommon struct{}
|
||||
// StreamWriter is provided some writing functions for extended format by user
|
||||
type StreamWriter struct {
|
||||
w io.Writer
|
||||
buf *common.Buffer
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte1Int64(w io.Writer, value int64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func CreateStreamWriter(w io.Writer, buf *common.Buffer) StreamWriter {
|
||||
return StreamWriter{w, buf}
|
||||
}
|
||||
|
||||
func (w *StreamWriter) WriteByte1Int64(value int64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte2Int64(w io.Writer, value int64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte2Int64(value int64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>8),
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte4Int64(w io.Writer, value int64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte4Int64(value int64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>24),
|
||||
byte(value>>16),
|
||||
byte(value>>8),
|
||||
@@ -36,8 +46,8 @@ func (c *StreamEncoderCommon) WriteByte4Int64(w io.Writer, value int64, buf *com
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte8Int64(w io.Writer, value int64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte8Int64(value int64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>56),
|
||||
byte(value>>48),
|
||||
byte(value>>40),
|
||||
@@ -49,21 +59,21 @@ func (c *StreamEncoderCommon) WriteByte8Int64(w io.Writer, value int64, buf *com
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte1Uint64(w io.Writer, value uint64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte1Uint64(value uint64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte2Uint64(w io.Writer, value uint64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte2Uint64(value uint64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>8),
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte4Uint64(w io.Writer, value uint64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte4Uint64(value uint64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>24),
|
||||
byte(value>>16),
|
||||
byte(value>>8),
|
||||
@@ -71,8 +81,8 @@ func (c *StreamEncoderCommon) WriteByte4Uint64(w io.Writer, value uint64, buf *c
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte8Uint64(w io.Writer, value uint64, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte8Uint64(value uint64) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>56),
|
||||
byte(value>>48),
|
||||
byte(value>>40),
|
||||
@@ -84,21 +94,21 @@ func (c *StreamEncoderCommon) WriteByte8Uint64(w io.Writer, value uint64, buf *c
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte1Int(w io.Writer, value int, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte1Int(value int) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte2Int(w io.Writer, value int, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte2Int(value int) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>8),
|
||||
byte(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte4Int(w io.Writer, value int, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte4Int(value int) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>24),
|
||||
byte(value>>16),
|
||||
byte(value>>8),
|
||||
@@ -106,8 +116,8 @@ func (c *StreamEncoderCommon) WriteByte4Int(w io.Writer, value int, buf *common.
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteByte4Uint32(w io.Writer, value uint32, buf *common.Buffer) error {
|
||||
return buf.Write(w,
|
||||
func (w *StreamWriter) WriteByte4Uint32(value uint32) error {
|
||||
return w.buf.Write(w.w,
|
||||
byte(value>>24),
|
||||
byte(value>>16),
|
||||
byte(value>>8),
|
||||
@@ -115,6 +125,6 @@ func (c *StreamEncoderCommon) WriteByte4Uint32(w io.Writer, value uint32, buf *c
|
||||
)
|
||||
}
|
||||
|
||||
func (c *StreamEncoderCommon) WriteBytes(w io.Writer, bs []byte, buf *common.Buffer) error {
|
||||
return buf.Write(w, bs...)
|
||||
func (w *StreamWriter) WriteBytes(bs []byte) error {
|
||||
return w.buf.Write(w.w, bs...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user