MCPcopy Index your code
hub / github.com/cloudnative-pg/cloudnative-pg / IsMapSubset

Function IsMapSubset

pkg/utils/operations.go:49–67  ·  view source on GitHub ↗

IsMapSubset returns true if mapSubset is a subset of mapSet otherwise false

(mapSet map[string]string, mapSubset map[string]string)

Source from the content-addressed store, hash-verified

47
48// IsMapSubset returns true if mapSubset is a subset of mapSet otherwise false
49func IsMapSubset(mapSet map[string]string, mapSubset map[string]string) bool {
50 if len(mapSet) < len(mapSubset) {
51 return false
52 }
53
54 if len(mapSubset) == 0 {
55 return true
56 }
57
58 for subMapKey, subMapValue := range mapSubset {
59 mapValue := mapSet[subMapKey]
60
61 if mapValue != subMapValue {
62 return false
63 }
64 }
65
66 return true
67}
68
69// IsLabelSubset checks if a collection of labels is a subset of another
70//

Callers 5

serviceReconcilerMethod · 0.92
operations_test.goFile · 0.85
IsLabelSubsetFunction · 0.85
IsAnnotationSubsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected