MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / MarshalProto

Function MarshalProto

pkg/redis/redis.go:59–66  ·  view source on GitHub ↗

MarshalProto marshals pb into printable string.

(pb proto.Message)

Source from the content-addressed store, hash-verified

57
58// MarshalProto marshals pb into printable string.
59func 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.
69func UnmarshalProto(s string, pb proto.Message) error {

Callers 4

mainFunction · 0.92
SetProtoFunction · 0.85
DeduplicateProtosFunction · 0.85
makeProtoStringFunction · 0.85

Calls 2

MarshalMethod · 0.65
WithCauseMethod · 0.45

Tested by 1

makeProtoStringFunction · 0.68