Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter keeps the msg fields that are listed in the paths and clears all the rest.
This is a handy wrapper for NestedMask.Filter method. If the same paths are used to process multiple proto messages use NestedMask.Filter method directly.
Types ¶
type NestedMask ¶
type NestedMask map[string]NestedMask
NestedMask represents a field mask as a recursive map.
func NestedMaskFromPaths ¶
func NestedMaskFromPaths(paths []string) NestedMask
NestedMaskFromPaths creates an instance of NestedMask for the given paths.
func (NestedMask) Filter ¶
func (mask NestedMask) Filter(msg proto.Message)
Filter keeps the msg fields that are listed in the paths and clears all the rest.
If the mask is empty then all the fields are kept. Paths are assumed to be valid and normalized otherwise the function may panic. See google.golang.org/protobuf/types/known/fieldmaskpb for details.
func (NestedMask) Overwrite ¶
func (mask NestedMask) Overwrite(src, dest proto.Message)
Overwrite overwrites all the fields listed in paths in the dest msg using values from src msg.
All other fields are kept untouched. If the mask is empty, no fields are overwritten. Supports scalars, messages, repeated fields, and maps. If the parent of the field is nil message, the parent is initiated before overwriting the field If the field in src is empty value, the field in dest is cleared. Paths are assumed to be valid and normalized otherwise the function may panic.
func (NestedMask) Prune ¶
func (mask NestedMask) Prune(msg proto.Message)
Prune clears all the fields listed in paths from the given msg.
All other fields are kept untouched. If the mask is empty no fields are cleared. This operation is the opposite of NestedMask.Filter. Paths are assumed to be valid and normalized otherwise the function may panic. See google.golang.org/protobuf/types/known/fieldmaskpb for details.