Documentation
¶
Index ¶
- func ApplyFieldMaskToNewMessage(source proto.Message, mask *fieldmaskpb.FieldMask) (proto.Message, error)
- func ApplyNestedField(target, source protoreflect.Message, path []string) error
- func ClearProto(in protoreflect.Message)
- func ClearRepeatedFields(msg proto.Message)
- func GenerateFieldMask(original, updated protoreflect.ProtoMessage) (*fieldmaskpb.FieldMask, error)
- func MergeSlices[T any](base, patch []T, keyFunc MergeFunc[T], mergeItem func(base, patch T) T) []T
- func StrategicMerge[T proto.Message](base, patch T, mergeFuncs ...func(b, p T)) T
- type MergeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFieldMaskToNewMessage ¶
func ApplyFieldMaskToNewMessage(source proto.Message, mask *fieldmaskpb.FieldMask) (proto.Message, error)
ApplyFieldMaskToNewMessage creates a new message containing only the fields specified in the FieldMask. If mask is nil then source is returned in its original unalterned state
func ApplyNestedField ¶
func ApplyNestedField(target, source protoreflect.Message, path []string) error
ApplyNestedField sets the value of a nested field in the target message based on the source message.
func ClearProto ¶
func ClearProto(in protoreflect.Message)
ClearProto resets fields on the proto message recursively
func ClearRepeatedFields ¶
ClearRepeatedFields will clear fields thare are of kind list FIX: Doesn't work on map fields
func GenerateFieldMask ¶
func GenerateFieldMask(original, updated protoreflect.ProtoMessage) (*fieldmaskpb.FieldMask, error)
GenerateFieldMask compares two protobuf messages and generates a FieldMask with changed fields.
func MergeSlices ¶
func StrategicMerge ¶
StrategicMerge merges patch into base strategically as defined by provided merge funcs. Non-repated fields are cleared recursively before mergefuncs are applied to avoid dupliced list elements. Does not currently support removal of list-elements.