// Add - adds key and value. The value is appended If key already exists. func (ckm ConditionKeyMap) Add(key string, value set.StringSet) { if v, ok := ckm[key]; ok { ckm[key] = v.Union(value) } else { ckm[key] = set.CopyStringSet(value) } }
// CopyConditionKeyMap - returns new copy of given ConditionKeyMap. func CopyConditionKeyMap(condKeyMap ConditionKeyMap) ConditionKeyMap { out := make(ConditionKeyMap) for k, v := range condKeyMap { out[k] = set.CopyStringSet(v) } return out }
// mergeConditionKeyMap - returns a new ConditionKeyMap which contains merged key/value of given two ConditionKeyMap. func mergeConditionKeyMap(condKeyMap1 ConditionKeyMap, condKeyMap2 ConditionKeyMap) ConditionKeyMap { out := CopyConditionKeyMap(condKeyMap1) for k, v := range condKeyMap2 { if ev, ok := out[k]; ok { out[k] = ev.Union(v) } else { out[k] = set.CopyStringSet(v) } } return out }