FindEnumByName looks up an enum by its full name; e.g., "google.protobuf.Field.Kind". This returns (nil, [protoregistry.NotFound]) if not found.
(name protoreflect.FullName)
| 50 | // |
| 51 | // This returns (nil, [protoregistry.NotFound]) if not found. |
| 52 | func (t *Types) FindEnumByName(name protoreflect.FullName) (protoreflect.EnumType, error) { |
| 53 | d, err := t.files.FindDescriptorByName(name) |
| 54 | if err != nil { |
| 55 | return nil, err |
| 56 | } |
| 57 | ed, ok := d.(protoreflect.EnumDescriptor) |
| 58 | if !ok { |
| 59 | return nil, errors.New("found wrong type: got %v, want enum", descName(d)) |
| 60 | } |
| 61 | return NewEnumType(ed), nil |
| 62 | } |
| 63 | |
| 64 | // FindExtensionByName looks up an extension field by the field's full name. |
| 65 | // Note that this is the full name of the field as determined by |