Skip to content

Commit 240a462

Browse files
authored
export run command (#47)
* export run command * fix test
1 parent 5912a4a commit 240a462

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

tools/certs/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
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()

tools/tpps/parse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

tools/tpps/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)