20 lines
356 B
Go
20 lines
356 B
Go
|
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))
|
||
|
}
|
||
|
|
||
|
func (Marshaler) Name() string {
|
||
|
return "proto"
|
||
|
}
|