mirror of
https://github.com/anchore/grype
synced 2024-11-12 23:37:06 +00:00
result: add a helper to get packages by ID
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
444b191404
commit
8fc7efd464
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,15 @@ func NewResult() Result {
|
|||
}
|
||||
}
|
||||
|
||||
// GetByPkgID returns a slice of potential matches from an ID
|
||||
func (r *Result) GetByPkgID(id pkg.ID) []match.Match {
|
||||
matches, ok := r.byPackage[id]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return matches
|
||||
}
|
||||
|
||||
func (r *Result) Merge(other Result) {
|
||||
// note: de-duplication of matches is an upstream concern (not here)
|
||||
for pkgID, matches := range other.byPackage {
|
||||
|
|
Loading…
Reference in a new issue