ipld-eth-server/pkg/repositories/postgres/helpers.go
Matt K aea9c7b5e2 Separate repositories (#25)
* Separate Repository into multiple Repositories

* Use struct scan for transactions

* Use struct scan for blocks

* Remove unused block repo methods

* Update naming

* Rename / Cleanup repository related fields
2018-02-02 15:53:16 -06:00

23 lines
612 B
Go

package postgres
import (
"github.com/vulcanize/vulcanizedb/pkg/config"
"github.com/vulcanize/vulcanizedb/pkg/core"
)
func ClearData(postgres *DB) {
postgres.DB.MustExec("DELETE FROM watched_contracts")
postgres.DB.MustExec("DELETE FROM transactions")
postgres.DB.MustExec("DELETE FROM blocks")
postgres.DB.MustExec("DELETE FROM logs")
postgres.DB.MustExec("DELETE FROM receipts")
postgres.DB.MustExec("DELETE FROM log_filters")
}
func BuildRepository(node core.Node) *DB {
cfg, _ := config.NewConfig("private")
repository, _ := NewDB(cfg.Database, node)
ClearData(repository)
return repository
}