mirror of
https://github.com/status-im/consul.git
synced 2025-02-06 19:04:59 +00:00
19 lines
503 B
Go
19 lines
503 B
Go
|
package protohcl
|
||
|
|
||
|
import "google.golang.org/protobuf/reflect/protoreflect"
|
||
|
|
||
|
type FieldNamer interface {
|
||
|
NameField(protoreflect.FieldDescriptor) string
|
||
|
GetField(protoreflect.FieldDescriptors, string) protoreflect.FieldDescriptor
|
||
|
}
|
||
|
|
||
|
type textFieldNamer struct{}
|
||
|
|
||
|
func (textFieldNamer) NameField(fd protoreflect.FieldDescriptor) string {
|
||
|
return fd.TextName()
|
||
|
}
|
||
|
|
||
|
func (textFieldNamer) GetField(fds protoreflect.FieldDescriptors, name string) protoreflect.FieldDescriptor {
|
||
|
return fds.ByTextName(name)
|
||
|
}
|