EnumDescriptorProto returns the file descriptor proto representing the enum and the enum descriptor proto for the enum itself. The returned proto messages must not be mutated.
(e proto.GeneratedEnum)
| 147 | // the enum and the enum descriptor proto for the enum itself. |
| 148 | // The returned proto messages must not be mutated. |
| 149 | func EnumDescriptorProto(e proto.GeneratedEnum) (*descriptorpb.FileDescriptorProto, *descriptorpb.EnumDescriptorProto) { |
| 150 | rawDesc, idxs := EnumRawDescriptor(e) |
| 151 | if rawDesc == nil || idxs == nil { |
| 152 | return nil, nil |
| 153 | } |
| 154 | fd := deriveFileDescriptor(rawDesc) |
| 155 | if len(idxs) == 1 { |
| 156 | return fd, fd.EnumType[idxs[0]] |
| 157 | } |
| 158 | md := fd.MessageType[idxs[0]] |
| 159 | for _, i := range idxs[1 : len(idxs)-1] { |
| 160 | md = md.NestedType[i] |
| 161 | } |
| 162 | ed := md.EnumType[idxs[len(idxs)-1]] |
| 163 | return fd, ed |
| 164 | } |
| 165 | |
| 166 | // MessageDescriptorProto returns the file descriptor proto representing |
| 167 | // the message and the message descriptor proto for the message itself. |