Documentation ¶
Overview ¶
Package proto implements utilities for managing GCP resource protos (e.g., copy, equal, merge).
Most of the implementations in this package are based on the implementations in the "official" proto package, i.e., "google.golang.org/protobuf/proto", with small modifications to serve Service Weaver GCP updating needs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
Copy copies all populated message fields from src into dst, overwriting any existing values in dst. Fields in skipFields aren't copied, even if they are populated. Returns the list of all fields in dst that were modified during the copy, or nil otherwise.
func Merge ¶
Merge merges src into dst, using the following merge strategy:
- Populated scalar fields in src are copied to dst.
- Populated singular message fields in src are recursively merged into dst.
- List fields in src are merged into dst as follows:
- If an element in src "matches" an element in dst, the src element is recursively merged into the dst element. (If multiple elements in dst are matched, the src element is merged only into the first matched one.)
- Otherwise, the src element is appended to the end of dst.
- Whether two elements "match" depends on their type: # For message types, the elements match iff their messages' comparison fields (specified in cmpFields) are equal. # For all other types, the elements match if they are equal.
- Map fields in src are merged into dst as follows:
- If an entry with a given key exists in both src and dst, the src entry is recursively merged into the dst entry.
- If an entry with a given key exists only in src, the src entry is inserted into dst.
Value true is returned iff dst was modified during the merge.
Types ¶
This section is empty.