예제 #1
0
func (s *PostgresTestSuite) SetupTest() {
	s.connection.Exec("DROP SCHEMA public CASCADE")
	s.connection.Exec("CREATE SCHEMA public")

	s.DriverTestSuite.Driver = postgres.New(CONNECTION_URL)
	s.DriverTestSuite.Reader = memory.NewMemoryReader(files)
}
예제 #2
0
파일: main.go 프로젝트: netw00rk/sqltractor
func getDriver(rawurl string) (driver.Driver, error) {
	u, err := url.Parse(rawurl)
	if err != nil {
		return nil, err
	}

	switch u.Scheme {
	case "cassandra":
		return cassandra.New(rawurl), nil
	case "postgres":
		return postgres.New(rawurl), nil
	case "mysql":
		return mysql.New(rawurl), nil
	case "sqlite3":
		return sqlite3.New(rawurl), nil
	}

	return nil, errors.New(fmt.Sprintf("Can't finde driver for scheme %s", u.Scheme))
}