FromAny() converts an anypb.Any type back into a proto.Message
(any *anypb.Any)
| 522 | |
| 523 | // FromAny() converts an anypb.Any type back into a proto.Message |
| 524 | func FromAny(any *anypb.Any) (proto.Message, ErrorI) { |
| 525 | // convert the proto any into a proto message |
| 526 | msg, err := anypb.UnmarshalNew(any, proto.UnmarshalOptions{}) |
| 527 | // if an error occurred during the conversion |
| 528 | if err != nil { |
| 529 | // exit with error |
| 530 | return nil, ErrFromAny(err) |
| 531 | } |
| 532 | // exit with the proto message |
| 533 | return msg, nil |
| 534 | } |
| 535 | |
| 536 | // BytesToString() converts a byte slice to a hexadecimal string |
| 537 | func BytesToString(b []byte) string { |