예제 #1
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))
}
예제 #2
0
func (s *SqliteTestSuite) SetupSuite() {
	s.DriverTestSuite.Driver = sqlite3.New(CONNECTION_URL)
	s.DriverTestSuite.Reader = memory.NewMemoryReader(files)
}