File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "time"
88)
99
10- func run () error {
10+ func Run () error {
1111 ctx := context .Background ()
1212 // Choose DB implementation here (Mongo or SQLite)
1313 db , err := setupMongoCertDb ()
Original file line number Diff line number Diff line change @@ -414,15 +414,15 @@ func parseRegistry() (<-chan models.TPP, error) {
414414 return res , nil
415415}
416416
417- func saveTPPs (db Db , out <- chan models.TPP ) error {
417+ func saveTPPs (dbImpl db , out <- chan models.TPP ) error {
418418 batchSize := 1000
419419 batch := make ([]models.TPP , 0 , batchSize )
420420 idx := 0
421421 for tpp := range out {
422422 idx += 1
423423 batch = append (batch , tpp )
424424 if idx == batchSize {
425- err := db .SaveTPPs (context .TODO (), "tpps" , batch )
425+ err := dbImpl .SaveTPPs (context .TODO (), "tpps" , batch )
426426 if err != nil {
427427 return err
428428 }
@@ -431,7 +431,7 @@ func saveTPPs(db Db, out <-chan models.TPP) error {
431431 }
432432 }
433433 if len (batch ) > 0 {
434- err := db .SaveTPPs (context .TODO (), "tpps" , batch )
434+ err := dbImpl .SaveTPPs (context .TODO (), "tpps" , batch )
435435 if err != nil {
436436 return err
437437 }
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import (
66 "github.com/botsman/tppVerifier/app/models"
77)
88
9- type Db interface {
9+ type db interface {
1010 SaveTPPs (ctx context.Context , collection string , tpp []models.TPP ) error
1111 Disconnect (ctx context.Context ) error
1212}
1313
14- func run () error {
14+ func Run () error {
1515 // Download and parse the registry
1616 // populate DB
1717 // 1. Download metadata at https://euclid.eba.europa.eu/register/api/filemetadata?t=1737374419184
You can’t perform that action at this time.
0 commit comments