mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
559c61e6b6
* Initial protohcl implementation Co-authored-by: Matt Keeler <mkeeler@users.noreply.github.com> Co-authored-by: Daniel Upton <daniel@floppy.co> * resourcehcl: implement resource decoding on top of protohcl Co-authored-by: Daniel Upton <daniel@floppy.co> * fix: resolve ci failures * test: add additional unmarshalling tests * refactor: update function test to clean protohcl package imports --------- Co-authored-by: Matt Keeler <mkeeler@users.noreply.github.com> Co-authored-by: Daniel Upton <daniel@floppy.co>
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)
|
|
}
|