Documentation ¶
Index ¶
- func AppendMarshal(v Encoder, buf []byte) ([]byte, error)
- func CopyToJSON(w io.Writer, r io.Reader) (written int, err error)
- func Decode(r io.Reader, v Decoder) error
- func Encode(w io.Writer, v Encoder) error
- func Marshal(v Encoder) ([]byte, error)
- func Unmarshal(p []byte, v Decoder) error
- type Decoder
- type Encoder
- type Raw
- type Reader
- func (r *Reader) Peek() (Type, error)
- func (r *Reader) ReadArrayHeader() (int, error)
- func (r *Reader) ReadArrayHeaderWithSize(size int) error
- func (r *Reader) ReadBool() (bool, error)
- func (r *Reader) ReadBytes(p []byte) ([]byte, error)
- func (r *Reader) ReadBytesNoCopy() ([]byte, error)
- func (r *Reader) ReadExt(typ int8, v encoding.BinaryUnmarshaler) error
- func (r *Reader) ReadFloat32() (float32, error)
- func (r *Reader) ReadFloat64() (float64, error)
- func (r *Reader) ReadInt() (int, error)
- func (r *Reader) ReadInt16() (int16, error)
- func (r *Reader) ReadInt32() (int32, error)
- func (r *Reader) ReadInt64() (int64, error)
- func (r *Reader) ReadInt8() (int8, error)
- func (r *Reader) ReadMapHeader() (int, error)
- func (r *Reader) ReadNil() error
- func (r *Reader) ReadRaw(raw Raw) (Raw, error)
- func (r *Reader) ReadString() (string, error)
- func (r *Reader) ReadTime() (time.Time, error)
- func (r *Reader) ReadUint() (uint, error)
- func (r *Reader) ReadUint16() (uint16, error)
- func (r *Reader) ReadUint32() (uint32, error)
- func (r *Reader) ReadUint64() (uint64, error)
- func (r *Reader) ReadUint8() (uint8, error)
- func (r *Reader) Skip() error
- type Type
- type TypeError
- type Writer
- func (w *Writer) WriteArrayHeader(length int) error
- func (w *Writer) WriteBool(b bool) error
- func (w *Writer) WriteBytes(b []byte) error
- func (w *Writer) WriteExt(typ int8, v encoding.BinaryMarshaler) error
- func (w *Writer) WriteFloat32(f float32) error
- func (w *Writer) WriteFloat64(f float64) error
- func (w *Writer) WriteInt(i int) error
- func (w *Writer) WriteInt16(i int16) error
- func (w *Writer) WriteInt32(i int32) error
- func (w *Writer) WriteInt64(i int64) error
- func (w *Writer) WriteInt8(i int8) error
- func (w *Writer) WriteMapHeader(length int) error
- func (w *Writer) WriteNil() error
- func (w *Writer) WriteRaw(r Raw) error
- func (w *Writer) WriteString(s string) error
- func (w *Writer) WriteTime(tm time.Time) error
- func (w *Writer) WriteUint(i uint) error
- func (w *Writer) WriteUint16(i uint16) error
- func (w *Writer) WriteUint32(i uint32) error
- func (w *Writer) WriteUint64(i uint64) error
- func (w *Writer) WriteUint8(i uint8) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendMarshal ¶
AppendMarshal encodes v into the MessagePack encoding and appends it to buf.
func CopyToJSON ¶
CopyToJSON is a helper function for reading MessagePack encoded data from r, transforming it to JSON, and writing it to w.
Types ¶
type Decoder ¶
Decoder defines an interface for types which are able to decode themselves from an MessagePack encoding.
type Encoder ¶
Encoder defines an interface for types which are able to encode themselves into an MessagePack encoding.
type Raw ¶
type Raw []byte
Raw is a raw encoded MessagePack value. It can be used to delay MessagePack decoding.
func (*Raw) DecodeMsgpack ¶
DecodeMsgpack reads the raw MessagePack value from r.
func (Raw) EncodeMsgpack ¶
EncodeMsgpack writes the raw MessagePack value into w.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader defines a reader for MessagePack encoded data.
func NewReaderBytes ¶
NewReaderBytes creates a reader for MessagePack encoded data. The reader reads all data from p.
func (*Reader) ReadArrayHeader ¶
ReadArrayHeader reads the header of an array value from the MessagePack stream and returns the number of elements.
func (*Reader) ReadArrayHeaderWithSize ¶
ReadArrayHeaderWithSize reads the header of an array value from the MessagePack stream and compares it to the given size. If the size of the array does not equal the given size, an error will be returned.
func (*Reader) ReadBytes ¶
ReadBytes reads a binary value from the MessagePack stream. The data will be copied to p if it fits. Otherwise a new slice will be allocated.
func (*Reader) ReadBytesNoCopy ¶
ReadBytesNoCopy reads a binary value from the MessagePack stream. The data is directly passed from the underlying buffer. This could result in a buffer reallocation.
func (*Reader) ReadExt ¶
func (r *Reader) ReadExt(typ int8, v encoding.BinaryUnmarshaler) error
ReadExt reads an extension value from the MessagePack stream. The given extension type must match the extension type found in the stream.
func (*Reader) ReadFloat32 ¶
ReadFloat32 reads a 32-bit floating-point value from the MessagePack stream.
func (*Reader) ReadFloat64 ¶
ReadFloat64 reads a 64-bit floating-point value from the MessagePack stream.
func (*Reader) ReadMapHeader ¶
ReadMapHeader reads the header of an map value from the MessagePack stream and returns the number of elements.
func (*Reader) ReadString ¶
ReadString reads a string value from the MessagePack stream.
func (*Reader) ReadUint16 ¶
ReadUint16 reads a 16-bit unsigned integer value from the MessagePack stream.
func (*Reader) ReadUint32 ¶
ReadUint32 reads a 32-bit unsigned integer value from the MessagePack stream.
func (*Reader) ReadUint64 ¶
ReadUint64 reads a 64-bit unsigned integer value from the MessagePack stream.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer defines a writer for MessagePack encoded data.
func (*Writer) WriteArrayHeader ¶
WriteArrayHeader writes the header of an array value to the MessagePack stream.
func (*Writer) WriteBytes ¶
WriteBytes writes a binary value to the MessagePack stream.
func (*Writer) WriteExt ¶
func (w *Writer) WriteExt(typ int8, v encoding.BinaryMarshaler) error
WriteExt writes an extension value to the MessagePack stream.
func (*Writer) WriteFloat32 ¶
WriteFloat32 writes a 32-bit floating-point value to the MessagePack stream.
func (*Writer) WriteFloat64 ¶
WriteFloat64 writes a 64-bit floating-point value to the MessagePack stream.
func (*Writer) WriteInt16 ¶
WriteInt16 writes a 16-bit integer value to the MessagePack stream.
func (*Writer) WriteInt32 ¶
WriteInt32 writes a 32-bit integer value to the MessagePack stream.
func (*Writer) WriteInt64 ¶
WriteInt64 writes a 64-bit integer value to the MessagePack stream.
func (*Writer) WriteMapHeader ¶
WriteMapHeader writes the header of an map value to the MessagePack stream.
func (*Writer) WriteRaw ¶
WriteRaw writes raw bytes to the MessagePack stream, which represent an already encoded section.
func (*Writer) WriteString ¶
WriteString writes a string value to the MessagePack stream.
func (*Writer) WriteUint16 ¶
WriteUint16 writes a 16-bit unsigned integer value to the MessagePack stream.
func (*Writer) WriteUint32 ¶
WriteUint32 writes a 32-bit unsigned integer value to the MessagePack stream.
func (*Writer) WriteUint64 ¶
WriteUint64 writes a 64-bit unsigned integer value to the MessagePack stream.
func (*Writer) WriteUint8 ¶
WriteUint8 writes an 8-bit unsigned integer value to the MessagePack stream.