You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/internal/protohcl/naming.go

22 lines
574 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
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)
}