2020-04-14 17:54:25 +03:00
|
|
|
package proto
|
|
|
|
|
|
|
|
type Message struct {
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
2020-04-14 19:13:38 +03:00
|
|
|
func (m *Message) MarshalJSON() ([]byte, error) {
|
2020-04-14 18:59:24 +03:00
|
|
|
return m.Data, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) UnmarshalJSON(data []byte) error {
|
|
|
|
m.Data = data
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-04-14 17:54:25 +03:00
|
|
|
func (m *Message) ProtoMessage() {}
|
|
|
|
|
|
|
|
func (m *Message) Reset() {
|
|
|
|
*m = Message{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) String() string {
|
|
|
|
return string(m.Data)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) Marshal() ([]byte, error) {
|
|
|
|
return m.Data, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) Unmarshal(data []byte) error {
|
|
|
|
m.Data = data
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewMessage(data []byte) *Message {
|
|
|
|
return &Message{data}
|
|
|
|
}
|