Documentation
¶
Index ¶
- func AllFields[T proto.Message]() *fieldmaskpb.FieldMask
- func AsTree(mask *fieldmaskpb.FieldMask) art.Tree
- func ByAbsence[T protoreflect.Message](msg T) *fieldmaskpb.FieldMask
- func ByPresence[T protoreflect.Message](msg T) *fieldmaskpb.FieldMask
- func Diff(old, new protoreflect.Message) *fieldmaskpb.FieldMask
- func ExclusiveDiscard(msg proto.Message, mask *fieldmaskpb.FieldMask)
- func ExclusiveKeep(msg proto.Message, mask *fieldmaskpb.FieldMask)
- func Leaves(mask *fieldmaskpb.FieldMask, desc protoreflect.MessageDescriptor) *fieldmaskpb.FieldMask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByAbsence ¶
func ByAbsence[T protoreflect.Message](msg T) *fieldmaskpb.FieldMask
func ByPresence ¶
func ByPresence[T protoreflect.Message](msg T) *fieldmaskpb.FieldMask
func Diff ¶
func Diff(old, new protoreflect.Message) *fieldmaskpb.FieldMask
Diff returns a FieldMask representing the fields that have changed between the old and new message. For repeated and map fields, the entire field is considered changed if any element has changed. Nested messages will be recursively compared to obtain a more fine-grained path if possible. The fieldmask returned is *not* normalized.
func ExclusiveDiscard ¶
func ExclusiveDiscard(msg proto.Message, mask *fieldmaskpb.FieldMask)
Recursively clears all fields except those NOT listed in the mask, such that: 1. ExclusiveDiscard(msg, ByPresence(msg)) == &T{} 2. ExclusiveDiscard(msg, ByAbsence(msg)) == msg
A nil mask is a no-op, and is not the same as a non-nil, empty mask.
func ExclusiveKeep ¶
func ExclusiveKeep(msg proto.Message, mask *fieldmaskpb.FieldMask)
Recursively clears all fields except those listed in the mask, such that: 1. ExclusiveKeep(msg, ByPresence(msg)) == msg 2. ExclusiveKeep(msg, ByAbsence(msg)) == &T{}
A nil mask is a no-op, and is not the same as a non-nil, empty mask.
func Leaves ¶
func Leaves(mask *fieldmaskpb.FieldMask, desc protoreflect.MessageDescriptor) *fieldmaskpb.FieldMask
Returns a new mask consisting of only the paths that correspond to leaf fields (non-message, terminal fields) in the given mask. The message descriptor is used to check whether a field is a leaf field.
Types ¶
This section is empty.