Skip to content

Commit

Permalink
add Go-style documentation header
Browse files Browse the repository at this point in the history
  • Loading branch information
lim-yoona committed Oct 8, 2023
1 parent bc6d4f0 commit b02637c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions message.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package msgpack

// Imessage is an interface that definds a message,
// which carries DataLen, MsgId and MsgData.
type Imessage interface {
GetDataLen() uint32
GetMsgId() uint32
GetMsgData() []byte
}

// Message implements Imessage.
type Message struct {
Id uint32
DataLen uint32
Data []byte
}

// NewMessage returns a message typed `*Message`.
func NewMessage(id, datalen uint32, data []byte) *Message {
return &Message{
Id: id,
Expand All @@ -20,12 +24,17 @@ func NewMessage(id, datalen uint32, data []byte) *Message {
}
}

// GetDataLen returns DataLen typed `uint32`.
func (msg *Message) GetDataLen() uint32 {
return msg.DataLen
}

// GetMsgId returns Id typed `uint32`.
func (msg *Message) GetMsgId() uint32 {
return msg.Id
}

// GetMsgData returns Data typed `[]byte`.
func (msg *Message) GetMsgData() []byte {
return msg.Data
}

0 comments on commit b02637c

Please sign in to comment.