clear sqlx db
This commit is contained in:
parent
75701bb45c
commit
6fe622e4bf
@ -24,7 +24,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/cerc-io/plugeth-statediff/indexer/database/sql"
|
||||
"github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres"
|
||||
"github.com/cerc-io/plugeth-statediff/indexer/shared/schema"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
// DedupFile removes duplicates from the given file
|
||||
@ -65,6 +67,12 @@ func TearDownDB(t *testing.T, db sql.Database) {
|
||||
}
|
||||
}
|
||||
|
||||
func ClearSqlxDB(sqlxdb *sqlx.DB) error {
|
||||
driver := postgres.NewSQLXDriver(context.Background(), sqlxdb)
|
||||
db := postgres.NewPostgresDB(driver, false)
|
||||
return ClearDB(db)
|
||||
}
|
||||
|
||||
func ClearDB(db sql.Database) error {
|
||||
ctx := context.Background()
|
||||
tx, err := db.Begin(ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user