github.com/btccom/go-micro/v2@v2.9.3/codec/proto/message.go (about)

     1  package proto
     2  
     3  type Message struct {
     4  	Data []byte
     5  }
     6  
     7  func (m *Message) MarshalJSON() ([]byte, error) {
     8  	return m.Data, nil
     9  }
    10  
    11  func (m *Message) UnmarshalJSON(data []byte) error {
    12  	m.Data = data
    13  	return nil
    14  }
    15  
    16  func (m *Message) ProtoMessage() {}
    17  
    18  func (m *Message) Reset() {
    19  	*m = Message{}
    20  }
    21  
    22  func (m *Message) String() string {
    23  	return string(m.Data)
    24  }
    25  
    26  func (m *Message) Marshal() ([]byte, error) {
    27  	return m.Data, nil
    28  }
    29  
    30  func (m *Message) Unmarshal(data []byte) error {
    31  	m.Data = data
    32  	return nil
    33  }
    34  
    35  func NewMessage(data []byte) *Message {
    36  	return &Message{data}
    37  }