Documentation
¶
Index ¶
- Variables
- type IMsgpReader
- type IMsgpWriter
- type MsgpReader
- type MsgpWriter
- func (w *MsgpWriter) WriteArray(n int) error
- func (w *MsgpWriter) WriteArray16(n int) error
- func (w *MsgpWriter) WriteArray32(n int) error
- func (w *MsgpWriter) WriteBin8(b []byte) error
- func (w *MsgpWriter) WriteBin16(b []byte) error
- func (w *MsgpWriter) WriteBin32(b []byte) error
- func (w *MsgpWriter) WriteBool(b bool) error
- func (w *MsgpWriter) WriteBytes(b []byte) error
- func (w *MsgpWriter) WriteExt(extType int8, data []byte) error
- func (w *MsgpWriter) WriteExt8(extType int8, data []byte) error
- func (w *MsgpWriter) WriteExt16(extType int8, data []byte) error
- func (w *MsgpWriter) WriteExt32(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixArray(n int) error
- func (w *MsgpWriter) WriteFixExt1(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixExt2(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixExt4(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixExt8(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixExt16(extType int8, data []byte) error
- func (w *MsgpWriter) WriteFixMap(n int) error
- func (w *MsgpWriter) WriteFixStr(s string) error
- func (w *MsgpWriter) WriteFloat32(f float32) error
- func (w *MsgpWriter) WriteFloat64(f float64) error
- func (w *MsgpWriter) WriteInt(i int) error
- func (w *MsgpWriter) WriteInt8(i int8) error
- func (w *MsgpWriter) WriteInt16(i int16) error
- func (w *MsgpWriter) WriteInt32(i int32) error
- func (w *MsgpWriter) WriteInt64(i int64) error
- func (w *MsgpWriter) WriteMap(n int) error
- func (w *MsgpWriter) WriteMap16(n int) error
- func (w *MsgpWriter) WriteMap32(n int) error
- func (w *MsgpWriter) WriteNegFixInt(i int8) error
- func (w *MsgpWriter) WriteNil() error
- func (w *MsgpWriter) WritePosFixInt(i uint8) error
- func (w *MsgpWriter) WriteStr8(s string) error
- func (w *MsgpWriter) WriteStr16(s string) error
- func (w *MsgpWriter) WriteStr32(s string) error
- func (w *MsgpWriter) WriteString(s string) error
- func (w *MsgpWriter) WriteUint(u uint) error
- func (w *MsgpWriter) WriteUint8(u uint8) error
- func (w *MsgpWriter) WriteUint16(u uint16) error
- func (w *MsgpWriter) WriteUint32(u uint32) error
- func (w *MsgpWriter) WriteUint64(u uint64) error
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EOF = io.EOF ErrTruncated = errors.New("msgpraw: truncated input") ErrUnknownType = errors.New("msgpraw: unknown msgp type") )
View Source
var ( ErrPosFixIntRange = errors.New("msgpraw: value out of PosFixInt range (0..127)") ErrNegFixIntRange = errors.New("msgpraw: value out of NegFixInt range (-32..-1)") ErrFixStrRange = errors.New("msgpraw: string length out of FixStr range (0..31)") ErrFixArrayRange = errors.New("msgpraw: array length out of FixArray range (0..15)") ErrFixMapRange = errors.New("msgpraw: map length out of FixMap range (0..15)") ErrFixExtSize = errors.New("msgpraw: data length does not match FixExt format size") ErrStr8Range = errors.New("msgpraw: string length out of Str8 range (0..255)") ErrStr16Range = errors.New("msgpraw: string length out of Str16 range (0..65535)") ErrStr32Range = errors.New("msgpraw: string length out of Str32 range (0..2^32-1)") ErrBin8Range = errors.New("msgpraw: data length out of Bin8 range (0..255)") ErrBin16Range = errors.New("msgpraw: data length out of Bin16 range (0..65535)") ErrBin32Range = errors.New("msgpraw: data length out of Bin32 range (0..2^32-1)") ErrArray16Range = errors.New("msgpraw: array length out of Array16 range (0..65535)") ErrArray32Range = errors.New("msgpraw: array length out of Array32 range (0..2^32-1)") ErrMap16Range = errors.New("msgpraw: map length out of Map16 range (0..65535)") ErrMap32Range = errors.New("msgpraw: map length out of Map32 range (0..2^32-1)") ErrExt8Range = errors.New("msgpraw: data length out of Ext8 range (0..255)") ErrExt16Range = errors.New("msgpraw: data length out of Ext16 range (0..65535)") ErrExt32Range = errors.New("msgpraw: data length out of Ext32 range (0..2^32-1)") ErrStringTooLong = errors.New("msgpraw: string too long for any Str format") ErrBytesTooLong = errors.New("msgpraw: byte slice too long for any Bin format") ErrArrayTooLong = errors.New("msgpraw: array too long for any Array format") ErrMapTooLong = errors.New("msgpraw: map too long for any Map format") ErrExtTooLong = errors.New("msgpraw: ext data too long for any Ext format") )
Functions ¶
This section is empty.
Types ¶
type IMsgpReader ¶
type IMsgpReader interface {
// Read reads the next msgp value.
//
// Return values:
// Type - the msgp tag byte
// int - element count for FixArray/Array16/Array32/FixMap/Map16/Map32; otherwise 0
// []byte - raw payload (sub-slice of Buff, no copy):
// scalars : the big-endian-encoded value bytes
// FixExt*/Ext* : [extType, dataBytes...] - caller does data[0], data[1:]
// FixArray/Array* : remainder of buffer; caller calls Read repeatedly
// FixMap/Map* : remainder of buffer; caller calls Read 2*count times
// Nil/True/False/PosFixInt/NegFixInt: nil
// error - io.EOF when buffer exhausted, ErrTruncated when input ends mid-value,
// ErrUnknownType when the tag is not a valid msgp format
Read() (Type, int, []byte, error)
Skip() error
}
type IMsgpWriter ¶
type IMsgpWriter interface {
// Scalars
WritePosFixInt(uint8) error
WriteNegFixInt(int8) error
WriteInt(int) error
WriteInt8(int8) error
WriteInt16(int16) error
WriteInt32(int32) error
WriteInt64(int64) error
WriteUint(uint) error
WriteUint8(uint8) error
WriteUint16(uint16) error
WriteUint32(uint32) error
WriteUint64(uint64) error
WriteFloat32(float32) error
WriteFloat64(float64) error
WriteNil() error
WriteBool(bool) error
// Auto-sized variable-length writers (pick the smallest format that fits).
WriteString(string) error
WriteBytes([]byte) error
WriteArray(int) error
WriteMap(int) error
WriteExt(extType int8, data []byte) error
// Explicit fixed-format variants. Each errors if the input does not fit
// the named format.
WriteFixStr(string) error
WriteStr8(string) error
WriteStr16(string) error
WriteStr32(string) error
WriteBin8([]byte) error
WriteBin16([]byte) error
WriteBin32([]byte) error
WriteFixArray(int) error
WriteArray16(int) error
WriteArray32(int) error
WriteFixMap(int) error
WriteMap16(int) error
WriteMap32(int) error
WriteFixExt1(extType int8, data []byte) error
WriteFixExt2(extType int8, data []byte) error
WriteFixExt4(extType int8, data []byte) error
WriteFixExt8(extType int8, data []byte) error
WriteFixExt16(extType int8, data []byte) error
WriteExt8(extType int8, data []byte) error
WriteExt16(extType int8, data []byte) error
WriteExt32(extType int8, data []byte) error
}
type MsgpReader ¶
type MsgpWriter ¶
type MsgpWriter struct {
Buff []byte
}
MsgpWriter appends msgpack-encoded values to Buff. Buff is exposed so callers can pre-size it: w := &MsgpWriter{Buff: make([]byte, 0, n)}.
func (*MsgpWriter) WriteArray ¶
func (w *MsgpWriter) WriteArray(n int) error
func (*MsgpWriter) WriteArray16 ¶
func (w *MsgpWriter) WriteArray16(n int) error
func (*MsgpWriter) WriteArray32 ¶
func (w *MsgpWriter) WriteArray32(n int) error
func (*MsgpWriter) WriteBin8 ¶
func (w *MsgpWriter) WriteBin8(b []byte) error
func (*MsgpWriter) WriteBin16 ¶
func (w *MsgpWriter) WriteBin16(b []byte) error
func (*MsgpWriter) WriteBin32 ¶
func (w *MsgpWriter) WriteBin32(b []byte) error
func (*MsgpWriter) WriteBool ¶
func (w *MsgpWriter) WriteBool(b bool) error
func (*MsgpWriter) WriteBytes ¶
func (w *MsgpWriter) WriteBytes(b []byte) error
func (*MsgpWriter) WriteExt16 ¶
func (w *MsgpWriter) WriteExt16(extType int8, data []byte) error
func (*MsgpWriter) WriteExt32 ¶
func (w *MsgpWriter) WriteExt32(extType int8, data []byte) error
func (*MsgpWriter) WriteFixArray ¶
func (w *MsgpWriter) WriteFixArray(n int) error
func (*MsgpWriter) WriteFixExt1 ¶
func (w *MsgpWriter) WriteFixExt1(extType int8, data []byte) error
func (*MsgpWriter) WriteFixExt2 ¶
func (w *MsgpWriter) WriteFixExt2(extType int8, data []byte) error
func (*MsgpWriter) WriteFixExt4 ¶
func (w *MsgpWriter) WriteFixExt4(extType int8, data []byte) error
func (*MsgpWriter) WriteFixExt8 ¶
func (w *MsgpWriter) WriteFixExt8(extType int8, data []byte) error
func (*MsgpWriter) WriteFixExt16 ¶
func (w *MsgpWriter) WriteFixExt16(extType int8, data []byte) error
func (*MsgpWriter) WriteFixMap ¶
func (w *MsgpWriter) WriteFixMap(n int) error
func (*MsgpWriter) WriteFixStr ¶
func (w *MsgpWriter) WriteFixStr(s string) error
func (*MsgpWriter) WriteFloat32 ¶
func (w *MsgpWriter) WriteFloat32(f float32) error
func (*MsgpWriter) WriteFloat64 ¶
func (w *MsgpWriter) WriteFloat64(f float64) error
func (*MsgpWriter) WriteInt ¶
func (w *MsgpWriter) WriteInt(i int) error
func (*MsgpWriter) WriteInt8 ¶
func (w *MsgpWriter) WriteInt8(i int8) error
func (*MsgpWriter) WriteInt16 ¶
func (w *MsgpWriter) WriteInt16(i int16) error
func (*MsgpWriter) WriteInt32 ¶
func (w *MsgpWriter) WriteInt32(i int32) error
func (*MsgpWriter) WriteInt64 ¶
func (w *MsgpWriter) WriteInt64(i int64) error
func (*MsgpWriter) WriteMap ¶
func (w *MsgpWriter) WriteMap(n int) error
func (*MsgpWriter) WriteMap16 ¶
func (w *MsgpWriter) WriteMap16(n int) error
func (*MsgpWriter) WriteMap32 ¶
func (w *MsgpWriter) WriteMap32(n int) error
func (*MsgpWriter) WriteNegFixInt ¶
func (w *MsgpWriter) WriteNegFixInt(i int8) error
func (*MsgpWriter) WriteNil ¶
func (w *MsgpWriter) WriteNil() error
func (*MsgpWriter) WritePosFixInt ¶
func (w *MsgpWriter) WritePosFixInt(i uint8) error
func (*MsgpWriter) WriteStr8 ¶
func (w *MsgpWriter) WriteStr8(s string) error
func (*MsgpWriter) WriteStr16 ¶
func (w *MsgpWriter) WriteStr16(s string) error
func (*MsgpWriter) WriteStr32 ¶
func (w *MsgpWriter) WriteStr32(s string) error
func (*MsgpWriter) WriteString ¶
func (w *MsgpWriter) WriteString(s string) error
func (*MsgpWriter) WriteUint ¶
func (w *MsgpWriter) WriteUint(u uint) error
func (*MsgpWriter) WriteUint8 ¶
func (w *MsgpWriter) WriteUint8(u uint8) error
func (*MsgpWriter) WriteUint16 ¶
func (w *MsgpWriter) WriteUint16(u uint16) error
func (*MsgpWriter) WriteUint32 ¶
func (w *MsgpWriter) WriteUint32(u uint32) error
func (*MsgpWriter) WriteUint64 ¶
func (w *MsgpWriter) WriteUint64(u uint64) error
type Type ¶
type Type byte
const ( PosFixInt Type = 0x00 PosFixIntMax Type = 0x7f FixMap Type = 0x80 FixMapMax Type = 0x8f FixArray Type = 0x90 FixArrayMax Type = 0x9f FixStr Type = 0xa0 FixStrMax Type = 0xbf Nil Type = 0xc0 False Type = 0xc2 True Type = 0xc3 Bin8 Type = 0xc4 Bin16 Type = 0xc5 Bin32 Type = 0xc6 Ext8 Type = 0xc7 Ext16 Type = 0xc8 Ext32 Type = 0xc9 Float32 Type = 0xca Float64 Type = 0xcb Uint8 Type = 0xcc Uint16 Type = 0xcd Uint32 Type = 0xce Uint64 Type = 0xcf Int8 Type = 0xd0 Int16 Type = 0xd1 Int32 Type = 0xd2 Int64 Type = 0xd3 FixExt1 Type = 0xd4 FixExt2 Type = 0xd5 FixExt4 Type = 0xd6 FixExt8 Type = 0xd7 FixExt16 Type = 0xd8 Str8 Type = 0xd9 Str16 Type = 0xda Str32 Type = 0xdb Array16 Type = 0xdc Array32 Type = 0xdd Map16 Type = 0xde Map32 Type = 0xdf NegFixInt Type = 0xe0 NegFixIntMax Type = 0xff )
Click to show internal directories.
Click to hide internal directories.