Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidFieldMask = errors.New("invalid field mask")
View Source
var ErrInvalidPath = errors.New("invalid path")
Functions ¶
func Update ¶
func Update[T protoreflect.ProtoMessage](targetMessage T, updateMessage T, updateMask FieldMask) error
Update updates the targetMessage with values from the updateMessage, updateMask specifies which fields need to be updated.
FieldMask should contain field names like in .proto file. Nested paths are supported (e.g. "foo.bar.xyz"). If nested field's parent is a nil value, it will be initialized with a default value. Nested paths inside a map are not supported.
See the following package for a FieldMask implementation: https://google.golang.org/protobuf/types/known/fieldmaskpb
Types ¶
type FieldMask ¶
type FieldMask interface {
GetPaths() []string
IsValid(protoreflect.ProtoMessage) bool
}
func All ¶
func All[T protoreflect.ProtoMessage](message T) FieldMask
All returns a field mask that contains all populated fields from the given message. It will only contain shallow fields from the root of the message, no nested ones.
Click to show internal directories.
Click to hide internal directories.