Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PatchBytes ¶
PatchBytes follows the same rules as above with PatchStruct, but instead of patching structpb.Structs, it patches the protobuf encoding. An error is returned if there are issues working with the data. If src is nil or empty, the result is a marshaled, empty struct.
func PatchStruct ¶
PatchStruct updates the struct found in dst with the values found in src. The intent of this helper is to provide a fallback mechanism for subtype attributes when the actual schema of the subtype attributes are unknown. As such, it's preferred to use other methods (such as mask mapping) when an actual message for the subtype is known.
The following rules apply:
The source (src) map is merged into the destination map (dst). If the source map is nil, the destination will be a valid, but empty, map.
Values are overwritten by the source map if they exist in both.
Values are deleted from the destination if they are set to null in the source.
Maps are recursively applied, meaning that a nested map at key "foo" in the destination would be patched with a map at key "foo" in the source.
A map in the destination is overwritten by a non-map in the source, and a non-map in the destination is overwritten by a map in the source.
PatchStruct returns the updated map as a copy, dst and src are not altered.
Types ¶
This section is empty.