2019-01-10 09:42:02 +00:00
|
|
|
package proto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Marshaler struct{}
|
|
|
|
|
|
|
|
func (Marshaler) Marshal(v interface{}) ([]byte, error) {
|
|
|
|
return proto.Marshal(v.(proto.Message))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Marshaler) Unmarshal(data []byte, v interface{}) error {
|
|
|
|
return proto.Unmarshal(data, v.(proto.Message))
|
|
|
|
}
|
|
|
|
|
2019-06-01 16:14:06 +08:00
|
|
|
func (Marshaler) String() string {
|
2019-01-10 09:42:02 +00:00
|
|
|
return "proto"
|
|
|
|
}
|