gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/codec/proto/marshaler.go (about) 1 package proto 2 3 import ( 4 "github.com/golang/protobuf/proto" 5 ) 6 7 type Marshaler struct{} 8 9 func (Marshaler) Marshal(v interface{}) ([]byte, error) { 10 return proto.Marshal(v.(proto.Message)) 11 } 12 13 func (Marshaler) Unmarshal(data []byte, v interface{}) error { 14 return proto.Unmarshal(data, v.(proto.Message)) 15 } 16 17 func (Marshaler) String() string { 18 return "proto" 19 }