github.com/quay/claircore@v1.5.28/test/postgres/scannerlist.go (about) 1 package postgres 2 3 import ( 4 "context" 5 6 "github.com/jackc/pgx/v4/pgxpool" 7 8 "github.com/quay/claircore" 9 ) 10 11 // InsertScannerList is to be used with `test.GenUniqueScanners()`. Inserts 12 // a ScannerList record for scanner IDs 0...n associated with provided manifest hash 13 func InsertScannerList(ctx context.Context, pool *pgxpool.Pool, hash claircore.Digest, n int) error { 14 for i := 0; i < n; i++ { 15 _, err := pool.Exec(ctx, 16 `INSERT INTO scannerlist 17 (manifest_id, scanner_id) 18 VALUES ($1, $2)`, 19 hash, 20 i, 21 ) 22 if err != nil { 23 return err 24 } 25 } 26 return nil 27 }