Skip to content

Commit

Permalink
optimize update query
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Taylor <[email protected]>
  • Loading branch information
sbtaylor15 committed Jul 31, 2024
1 parent e146cc1 commit 2c16cd4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@ func LoadFromOSVDev() {
aql := `FOR vuln IN vulns
LET purls = UNIQUE(
FOR affected IN vuln.affected
FILTER HAS(affected, 'package') AND HAS(affected.package, 'purl')
RETURN FIRST(SPLIT(affected.package.purl, '?'))
FILTER LENGTH(affected.package.purl) > 0
LET purl = FIRST(SPLIT(affected.package.purl, '?'))
RETURN purl
)
FILTER LENGTH(purls) > 0
UPDATE { _key: vuln._key } WITH { purls: purls } IN vulns`

ctx := context.Background() // use default database context
Expand Down

0 comments on commit 2c16cd4

Please sign in to comment.