Marshal() serializes a proto.Message into a byte slice
(message any)
| 256 | |
| 257 | // Marshal() serializes a proto.Message into a byte slice |
| 258 | func Marshal(message any) ([]byte, ErrorI) { |
| 259 | // convert the message into proto bytes using the proto marshaller |
| 260 | protoBytes, err := marshaller.Marshal(message.(proto.Message)) |
| 261 | // if an error occurred during the conversion process |
| 262 | if err != nil { |
| 263 | // exit with a wrapped error |
| 264 | return nil, ErrMarshal(err) |
| 265 | } |
| 266 | // exit |
| 267 | return protoBytes, nil |
| 268 | } |
| 269 | |
| 270 | // Unmarshal() deserializes a byte slice into a proto.Message |
| 271 | func Unmarshal(protoBytes []byte, ptr any) ErrorI { |