Documentation
¶
Index ¶
- Variables
- func AppendList(in proto.Message, fieldName string, values ...proto.Message)
- func DescriptorName(value proto.Message) string
- func IsCodeField(message proto.Message) bool
- func IsValidElementType(name string) bool
- func IsValidResourceType(name string) bool
- func Overwrite(in proto.Message, fieldName string, values ...proto.Message)
- func StringValueFromCodeField(message proto.Message) (string, bool)
- func TypeToContainedResourceOneOfFieldName(resource string) protoreflect.Name
- func UnwrapOneofField(element proto.Message, fieldName string) proto.Message
- type ElementFieldRefs
- type Field
- type FieldToValueFunc
- type ResourceFieldRefs
Constants ¶
This section is empty.
Variables ¶
var ( // Resources is a map of all resource names to their corresponding field references. Resources map[string]*ResourceFieldRefs // Elements is a map of all element names to their corresponding field references. Elements map[string]*ElementFieldRefs )
Functions ¶
func AppendList ¶
AppendList updates a field of the given name in-place for the specified message.
This function will panic if the field is not a repeated-field.
func DescriptorName ¶
DescriptorName gets the type name of a proto Message. If value is nil, this returns an empty string.
func IsCodeField ¶
IsCodeField returns true if the message represents a FHIR code type. Codes with enum values and string values are both considered valid.
func IsValidElementType ¶
IsValidElementType checks that the given name is a valid element name
func IsValidResourceType ¶
IsValidResourceType checks that the given name is a valid resource name
func Overwrite ¶
Overwrite overwrites a field of the given name for the specified message. If `values` is empty, the field is cleared. If `values` contains more than one entry for a non-repeated field, this panics.
func StringValueFromCodeField ¶
StringValueFromCodeField gets the Field Descriptor of a message that represents a FHIR Code type. Returns the string value of the enum or string value of the Code, along with a boolean flag representing whether or not the input is a code type.
func TypeToContainedResourceOneOfFieldName ¶
func TypeToContainedResourceOneOfFieldName(resource string) protoreflect.Name
TypeToContainedResourceOneOfFieldName converts a resource type name into their respective ContainedResource "OneOf" field.
func UnwrapOneofField ¶
UnwrapOneofField obtains the underlying Message for "Oneof" elements contained in fields with the given fieldName. Returns nil if the input message doesn't have the given field, or if the Oneof descriptor is unpopulated.
Types ¶
type ElementFieldRefs ¶
type ElementFieldRefs struct { // Extension contains back-references for the Extension to this type Extension struct { // ValueX is the Extension.ValueX field that corresponds to // this resource. // // This field cannot be nil, as all R4 resources are valid contained-resource // types. ValueX protoreflect.FieldDescriptor } // New is a function that will create a new instance of this FHIR element. New func() proto.Message }
ElementFieldRefs is a container of back-references for a specified Element. This enables finding one-ofs that can work with the resource it represents, for easier/faster lookup than waiting on protoreflect APIs.
type Field ¶
type Field struct { Value protoreflect.Value Descriptor protoreflect.FieldDescriptor }
Field is a struct containing both the Value and FieldDescriptor for a proto field.
type FieldToValueFunc ¶
type FieldToValueFunc func(protoreflect.Message, protoreflect.FieldDescriptor) protoreflect.Value
FieldToValueFunc is a function converting a protoreflect.Message's field-descriptor into a Value.
This corresponds to either `protoreflect.Message.Mutable` or `protoreflect.Message.NewField`.
This type is an implementation-detail shared through various APIs that support a mix of appending or overwriting sequences.
type ResourceFieldRefs ¶
type ResourceFieldRefs struct { // ContainedResource contains back-references for the ContainedResource to // this type ContainedResource struct { // Resource is the ContainedResource.Resource field that corresponds to // this resource. // // This field cannot be nil, as all R4 resources are valid contained-resource // types. Resource protoreflect.FieldDescriptor } // New is a function that will create a new instance of this FHIR Resource. New func() proto.Message }
ResourceFieldRefs is a container of back-references for a specified Resource. This enables finding one-ofs that can work with the resource it represents, for easier/faster lookup than waiting on protoreflect APIs.