diff --git a/indexer/test_helpers/test_helpers.go b/indexer/test_helpers/test_helpers.go index 6a4da69..ee71cb5 100644 --- a/indexer/test_helpers/test_helpers.go +++ b/indexer/test_helpers/test_helpers.go @@ -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)