// Add add item to the list when the item not exists in list
Add add item to the list when the item not exists in list
// Add add item to the list when the item not exists in list
func (l *VulnerabilityItemList) Add(items ...*VulnerabilityItem) {
	if l.indexed == nil {
		l.indexed = map[string]*VulnerabilityItem{}
	}
	for _, item := range items {
		key := item.Key()
		if v, ok := l.indexed[key]; ok {
			v.ArtifactDigests = append(v.ArtifactDigests, item.ArtifactDigests...)
		} else {
			l.items = append(l.items, item)
			l.indexed[key] = item
		}
	}
}
func ( l * VulnerabilityItemList ) Add ( items ... * VulnerabilityItem ) { if l . indexed == nil { l . indexed = map [ string ] * VulnerabilityItem { } } for _ , item := range items { key := item . Key ( ) if v , ok := l . indexed [ key ] ; ok { v . ArtifactDigests = append ( v . ArtifactDigests , item . ArtifactDigests ... ) } else { l . items = append ( l . items , item ) l . indexed [ key ] = item } } }
Add add item to the list when the item not exists in list
Add add item to the list when the item not exists in list