Documentation
¶
Overview ¶
Package fastmsg provides Go implementation of the fastmsg Message class
Index ¶
- type Message
- func (m *Message) AddBytes(bytes []byte) *Message
- func (m *Message) AddInt16(value int16) *Message
- func (m *Message) AddInt32(value int32) *Message
- func (m *Message) AddInt64(value int64) *Message
- func (m *Message) AddInt8(b int8) *Message
- func (m *Message) AddMessage(message *Message) *Message
- func (m *Message) AddString(str string) *Message
- func (m *Message) AddUInt16(value uint16) *Message
- func (m *Message) AddUInt32(value uint32) *Message
- func (m *Message) AddUInt64(value uint64) *Message
- func (m *Message) AddUInt8(b uint8) *Message
- func (m *Message) Clear() *Message
- func (m *Message) ReadBytes() []byte
- func (m *Message) ReadInt16() int16
- func (m *Message) ReadInt32() int32
- func (m *Message) ReadInt64() int64
- func (m *Message) ReadInt8() int8
- func (m *Message) ReadMessage() *Message
- func (m *Message) ReadString() string
- func (m *Message) ReadUInt16() uint16
- func (m *Message) ReadUInt32() uint32
- func (m *Message) ReadUInt64() uint64
- func (m *Message) ReadUInt8() uint8
- func (m *Message) Reset()
- func (m *Message) Seal() []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a packed data buffer. It is used for both serializing and deserializing data. All numbers are stored in little-endian byte order.
func NewMessage ¶
func NewMessage() *Message
NewMessage creates a new Message instance for serializing data.
func NewMessageFromBuffer ¶
NewMessageFromBuffer creates a new Message instance from a buffer for deserializing data.
func (*Message) AddBytes ¶
AddBytes adds a byte slice to the message buffer. The byte slice is prefixed with its length as a uint32.
func (*Message) AddMessage ¶
AddMessage adds a Message to the message buffer. The Message is prefixed with its length as a uint32.
func (*Message) AddString ¶
AddString adds a string to the message buffer. The string is prefixed with its length as a uint32.
func (*Message) ReadBytes ¶
ReadBytes reads a byte slice from the message buffer and advances the cursor. If there's not enough data to read, it returns nil.
func (*Message) ReadInt16 ¶
ReadInt16 reads an int16 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadInt32 ¶
ReadInt32 reads an int32 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadInt64 ¶
ReadInt64 reads an int64 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadInt8 ¶
ReadInt8 reads an int8 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadMessage ¶
ReadMessage reads a Message from the message buffer and advances the cursor. If there's not enough data to read, it returns nil.
func (*Message) ReadString ¶
ReadString reads a string from the message buffer and advances the cursor. If there's not enough data to read, it returns an empty string.
func (*Message) ReadUInt16 ¶
ReadUInt16 reads a uint16 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadUInt32 ¶
ReadUInt32 reads a uint32 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadUInt64 ¶
ReadUInt64 reads a uint64 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.
func (*Message) ReadUInt8 ¶
ReadUInt8 reads a uint8 from the message buffer and advances the cursor. If there's not enough data to read, it returns 0.