Documentation ¶
Index ¶
- Constants
- Variables
- func InfoOf(b uint8) uint8
- func ToBytes(codec Codec) ([]byte, error)
- func TypeOf(b uint8) uint8
- type Codec
- type DataReader
- func (d *DataReader) CheckError() error
- func (d *DataReader) Discard(length uint32) error
- func (d *DataReader) GetBytes(length uint32) ([]byte, error)
- func (d *DataReader) GetFloat32() (float32, error)
- func (d *DataReader) GetFloat64() (float64, error)
- func (d *DataReader) GetInt16() (int16, error)
- func (d *DataReader) GetInt32() (int32, error)
- func (d *DataReader) GetInt64() (int64, error)
- func (d *DataReader) GetInt8() (int8, error)
- func (d *DataReader) GetUint16() (uint16, error)
- func (d *DataReader) GetUint32() (uint32, error)
- func (d *DataReader) GetUint64() (uint64, error)
- func (d *DataReader) GetUint8() (uint8, error)
- func (d *DataReader) PeekUint8() (uint8, error)
- func (d *DataReader) SetBytes(src []byte) error
- func (d *DataReader) SetFloat32(value float32) error
- func (d *DataReader) SetFloat64(value float64) error
- func (d *DataReader) SetInt16(value int16) error
- func (d *DataReader) SetInt32(value int32) error
- func (d *DataReader) SetInt64(value int64) error
- func (d *DataReader) SetInt8(value int8) error
- func (d *DataReader) SetUint16(value uint16) error
- func (d *DataReader) SetUint32(value uint32) error
- func (d *DataReader) SetUint64(value uint64) error
- func (d *DataReader) SetUint8(value uint8) error
- type Decoder
- func (d *Decoder) IsNextNil() (bool, error)
- func (d *Decoder) Pos() uint32
- func (d *Decoder) ReadArraySize() (uint32, bool, error)
- func (d *Decoder) ReadBool() (bool, error)
- func (d *Decoder) ReadByteArray() ([]byte, error)
- func (d *Decoder) ReadFloat32() (float32, error)
- func (d *Decoder) ReadFloat64() (float64, error)
- func (d *Decoder) ReadInt16() (int16, error)
- func (d *Decoder) ReadInt32() (int32, error)
- func (d *Decoder) ReadInt64() (int64, error)
- func (d *Decoder) ReadInt8() (int8, error)
- func (d *Decoder) ReadMapSize() (uint32, bool, error)
- func (d *Decoder) ReadNull() (bool, error)
- func (d *Decoder) ReadString() (string, error)
- func (d *Decoder) ReadTag() (uint64, error)
- func (d *Decoder) ReadUint16() (uint16, error)
- func (d *Decoder) ReadUint32() (uint32, error)
- func (d *Decoder) ReadUint64() (uint64, error)
- func (d *Decoder) ReadUint8() (uint8, error)
- func (d *Decoder) Skip() error
- type Encoder
- func (e *Encoder) CheckError() error
- func (e *Encoder) WriteArraySize(length uint32)
- func (e *Encoder) WriteBool(value bool)
- func (e *Encoder) WriteByteArray(value []byte)
- func (e *Encoder) WriteFloat32(value float32)
- func (e *Encoder) WriteFloat64(value float64)
- func (e *Encoder) WriteInt16(value int16)
- func (e *Encoder) WriteInt32(value int32)
- func (e *Encoder) WriteInt64(value int64)
- func (e *Encoder) WriteInt8(value int8)
- func (e *Encoder) WriteMapSize(length uint32)
- func (e *Encoder) WriteNil()
- func (e *Encoder) WriteString(value string)
- func (e *Encoder) WriteUint16(value uint16)
- func (e *Encoder) WriteUint32(value uint32)
- func (e *Encoder) WriteUint64(value uint64)
- func (e *Encoder) WriteUint8(value uint8)
- type ReadError
- type Sizer
- func (s *Sizer) CheckError() error
- func (s *Sizer) Len() uint32
- func (s *Sizer) WriteArraySize(length uint32)
- func (s *Sizer) WriteBool(value bool)
- func (s *Sizer) WriteByteArray(value []byte)
- func (s *Sizer) WriteFloat32(value float32)
- func (s *Sizer) WriteFloat64(value float64)
- func (s *Sizer) WriteInt16(value int16)
- func (s *Sizer) WriteInt32(value int32)
- func (s *Sizer) WriteInt64(value int64)
- func (s *Sizer) WriteInt8(value int8)
- func (s *Sizer) WriteMapSize(length uint32)
- func (s *Sizer) WriteNil()
- func (s *Sizer) WriteString(value string)
- func (s *Sizer) WriteUint16(value uint16)
- func (s *Sizer) WriteUint32(value uint32)
- func (s *Sizer) WriteUint64(value uint64)
- func (s *Sizer) WriteUint8(value uint8)
- type Writer
Constants ¶
View Source
const ( TypeU8ShortMin = 0x00 TypeU8ShortMax = 0x17 TypeU8 = 0x18 TypeU16 = 0x19 TypeU32 = 0x1a TypeU64 = 0x1b TypeI8ShortMin = 0x20 TypeI8ShortMax = 0x37 TypeI8 = 0x38 TypeI16 = 0x39 TypeI32 = 0x3a TypeI64 = 0x3b TypeBytesIndef = 0x5f TypeArrayIndef = 0x9f TypeMapIndef = 0xbf TypeTagMax = 0xdb TypeBoolFalse = 0xf4 TypeBoolTrue = 0xf5 TypeNull = 0xf6 TypeUndefined = 0xf7 TypeF16 = 0xf9 TypeF32 = 0xfa TypeF64 = 0xfb TypeBreak = 0xff TypeMajorUnsigned = 0x00 // major type : high 3 bits TypeMajorSigned = 0x20 // major type : high 3 bits TypeMajorBytes = 0x40 // major type : high 3 bits TypeMajorText = 0x60 // major type : high 3 bits TypeMajorArray = 0x80 // major type : high 3 bits TypeMajorMap = 0xa0 // major type : high 3 bits TypeMajorTagged = 0xc0 // major type : high 3 bits TypeMajorSimple = 0xe0 // major type : high 3 bits )
Variables ¶
View Source
var ErrRange = errors.New("range error")
Functions ¶
Types ¶
type Codec ¶
Codec is the interface that applies to data structures that can encode to and decode from the MessagPack format.
type DataReader ¶
type DataReader struct {
// contains filtered or unexported fields
}
func NewDataReader ¶
func NewDataReader(buffer []byte) DataReader
func (*DataReader) CheckError ¶
func (d *DataReader) CheckError() error
check whether any errors have occurred
func (*DataReader) Discard ¶
func (d *DataReader) Discard(length uint32) error
func (*DataReader) GetFloat32 ¶
func (d *DataReader) GetFloat32() (float32, error)
func (*DataReader) GetFloat64 ¶
func (d *DataReader) GetFloat64() (float64, error)
func (*DataReader) GetInt16 ¶
func (d *DataReader) GetInt16() (int16, error)
func (*DataReader) GetInt32 ¶
func (d *DataReader) GetInt32() (int32, error)
func (*DataReader) GetInt64 ¶
func (d *DataReader) GetInt64() (int64, error)
func (*DataReader) GetInt8 ¶
func (d *DataReader) GetInt8() (int8, error)
func (*DataReader) GetUint16 ¶
func (d *DataReader) GetUint16() (uint16, error)
func (*DataReader) GetUint32 ¶
func (d *DataReader) GetUint32() (uint32, error)
func (*DataReader) GetUint64 ¶
func (d *DataReader) GetUint64() (uint64, error)
func (*DataReader) GetUint8 ¶
func (d *DataReader) GetUint8() (uint8, error)
func (*DataReader) PeekUint8 ¶
func (d *DataReader) PeekUint8() (uint8, error)
func (*DataReader) SetBytes ¶
func (d *DataReader) SetBytes(src []byte) error
func (*DataReader) SetFloat32 ¶
func (d *DataReader) SetFloat32(value float32) error
func (*DataReader) SetFloat64 ¶
func (d *DataReader) SetFloat64(value float64) error
func (*DataReader) SetInt16 ¶
func (d *DataReader) SetInt16(value int16) error
func (*DataReader) SetInt32 ¶
func (d *DataReader) SetInt32(value int32) error
func (*DataReader) SetInt64 ¶
func (d *DataReader) SetInt64(value int64) error
func (*DataReader) SetInt8 ¶
func (d *DataReader) SetInt8(value int8) error
func (*DataReader) SetUint16 ¶
func (d *DataReader) SetUint16(value uint16) error
func (*DataReader) SetUint32 ¶
func (d *DataReader) SetUint32(value uint32) error
func (*DataReader) SetUint64 ¶
func (d *DataReader) SetUint64(value uint64) error
func (*DataReader) SetUint8 ¶
func (d *DataReader) SetUint8(value uint8) error
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func (*Decoder) ReadArraySize ¶
For arrays of defined length, second value in return tuple should be false.
func (*Decoder) ReadByteArray ¶
func (*Decoder) ReadFloat32 ¶
func (*Decoder) ReadFloat64 ¶
func (*Decoder) ReadString ¶
Read string of defined length
func (*Decoder) ReadUint16 ¶
func (*Decoder) ReadUint32 ¶
func (*Decoder) ReadUint64 ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func (*Encoder) CheckError ¶
check whether any errors have occurred
func (*Encoder) WriteArraySize ¶
func (*Encoder) WriteByteArray ¶
func (*Encoder) WriteFloat32 ¶
func (*Encoder) WriteFloat64 ¶
func (*Encoder) WriteInt64 ¶
func (*Encoder) WriteMapSize ¶
func (*Encoder) WriteString ¶
func (*Encoder) WriteUint16 ¶
func (*Encoder) WriteUint32 ¶
func (*Encoder) WriteUint8 ¶
type ReadError ¶
type ReadError struct {
// contains filtered or unexported fields
}
func NewReadError ¶
type Sizer ¶
type Sizer struct {
// contains filtered or unexported fields
}
func (*Sizer) CheckError ¶
check whether any errors have occurred
func (*Sizer) WriteArraySize ¶
func (*Sizer) WriteByteArray ¶
func (*Sizer) WriteFloat32 ¶
func (*Sizer) WriteFloat64 ¶
func (*Sizer) WriteInt16 ¶
func (*Sizer) WriteInt32 ¶
func (*Sizer) WriteInt64 ¶
func (*Sizer) WriteMapSize ¶
func (*Sizer) WriteString ¶
func (*Sizer) WriteUint16 ¶
func (*Sizer) WriteUint32 ¶
func (*Sizer) WriteUint64 ¶
func (*Sizer) WriteUint8 ¶
type Writer ¶
type Writer interface { WriteNil() WriteBool(value bool) WriteInt8(value int8) WriteInt16(value int16) WriteInt32(value int32) WriteInt64(value int64) WriteUint8(value uint8) WriteUint16(value uint16) WriteUint32(value uint32) WriteUint64(value uint64) WriteFloat32(value float32) WriteFloat64(value float64) WriteString(value string) WriteByteArray(value []byte) WriteArraySize(length uint32) WriteMapSize(length uint32) CheckError() error }
Writer is the interface for writing data using the MessagePack format.
Click to show internal directories.
Click to hide internal directories.