MarshalProto marshals pb into printable string.
(pb proto.Message)
| 57 | |
| 58 | // MarshalProto marshals pb into printable string. |
| 59 | func MarshalProto(pb proto.Message) (string, error) { |
| 60 | b, err := proto.Marshal(pb) |
| 61 | if err != nil { |
| 62 | return "", errEncode.WithCause(err) |
| 63 | } |
| 64 | protosMarshaled.Inc() |
| 65 | return encoding.EncodeToString(b), nil |
| 66 | } |
| 67 | |
| 68 | // UnmarshalProto unmarshals string returned from MarshalProto into pb. |
| 69 | func UnmarshalProto(s string, pb proto.Message) error { |