2019-01-10 12:42:02 +03: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 11:14:06 +03:00
|
|
|
func (Marshaler) String() string {
|
2019-01-10 12:42:02 +03:00
|
|
|
return "proto"
|
|
|
|
}
|