Documentation ¶
Overview ¶
This file contains the implementation of proto.Merge, with new merge options. It also differentiates between null and zero values of Duration and Timestamp.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
Merge merges src into dst, which must be a message with the same descriptor.
Populated scalar fields in src are copied to dst, while populated singular messages in src are merged into dst by recursively calling Merge. The elements of every list field in src is appended to the corresponded list fields in dst, unless the ReplaceLists option is true, in which case the list fields in dst are replaced entirely. The entries of every map field in src is copied into the corresponding map field in dst, possibly replacing existing entries. The unknown fields of src are appended to the unknown fields of dst.
It is semantically equivalent to unmarshaling the encoded form of src into dst with the UnmarshalOptions.Merge option specified.
func MergeWithReplace ¶
MergeWithReplace is like Merge, but replaces lists and maps instead of appending to them.
Types ¶
type MergeOptions ¶
type MergeOptions struct { // If true, slices are replaced instead of appended to. ReplaceLists bool // If true, maps are replaced instead of merged. ReplaceMaps bool }
MergeOptions provides a namespace for merge functions, and can be exported in the future if we add user-visible merge options.
func (MergeOptions) Merge ¶
func (o MergeOptions) Merge(dst, src proto.Message)