MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / Marshal

Method Marshal

runtime/marshal_proto.go:19–25  ·  view source on GitHub ↗

Marshal marshals "value" into Proto

(value interface{})

Source from the content-addressed store, hash-verified

17
18// Marshal marshals "value" into Proto
19func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) {
20 message, ok := value.(proto.Message)
21 if !ok {
22 return nil, errors.New("unable to marshal non proto field")
23 }
24 return proto.Marshal(message)
25}
26
27// Unmarshal unmarshals proto "data" into "value"
28func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error {

Callers 2

NewEncoderMethod · 0.95

Calls 1

MarshalMethod · 0.65

Tested by 1