Documentation ¶
Overview ¶
Package fieldbehavior provides primitives for implementing AIP fieldbehavior annotations.
See: https://google.aip.dev/203 (Field behavior doucumentation)
Index ¶
- func ClearFields(message proto.Message, behaviorsToClear ...annotations.FieldBehavior)
- func CopyFields(dst, src proto.Message, behaviorsToCopy ...annotations.FieldBehavior)
- func Get(field protoreflect.FieldDescriptor) []annotations.FieldBehavior
- func Has(field protoreflect.FieldDescriptor, want annotations.FieldBehavior) bool
- func ValidateRequiredFields(m proto.Message) error
- func ValidateRequiredFieldsWithMask(m proto.Message, mask *fieldmaskpb.FieldMask) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearFields ¶
func ClearFields(message proto.Message, behaviorsToClear ...annotations.FieldBehavior)
ClearFields clears all fields annotated with any of the provided behaviors.
func CopyFields ¶
func CopyFields(dst, src proto.Message, behaviorsToCopy ...annotations.FieldBehavior)
CopyFields copies all fields annotated with any of the provided behaviors from src to dst.
func Get ¶
func Get(field protoreflect.FieldDescriptor) []annotations.FieldBehavior
Get returns the field behavior of the provided field descriptor.
func Has ¶
func Has(field protoreflect.FieldDescriptor, want annotations.FieldBehavior) bool
Has returns true if the provided field descriptor has the wanted field behavior.
func ValidateRequiredFields ¶
ValidateRequiredFields returns a validation error if any field annotated as required does not have a value. See: https://aip.dev/203
func ValidateRequiredFieldsWithMask ¶
func ValidateRequiredFieldsWithMask(m proto.Message, mask *fieldmaskpb.FieldMask) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.