fieldmask

package
v0.0.0-...-623d1b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFields

func AllFields[T proto.Message]() *fieldmaskpb.FieldMask

func AsTree

func AsTree(mask *fieldmaskpb.FieldMask) art.Tree

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL