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