func mymysqlDriverOpener(username, password, dbName, host string, port int, connVars adapters.ConnVariables) (*sqlx.DB, error) {
	db, stdErr := sqlx.Connect("sqlite3", dbName)
	if stdErr != nil {
		return nil, errs.Wrap(stdErr, errs.Info{})
	}
	return db, nil
}
func goSqlDriverOpener(username, password, dbName, host string, port int, connVars adapters.ConnVariables) (*sqlx.DB, error) {
	sourceString := fmt.Sprintf(
		"%s:%s@tcp(%s:%d)/%s?%s",
		username, password, host, port, dbName, connVars.Join("&"))
	db, err := sqlx.Connect("mysql", sourceString)
	if err != nil {
		return nil, errs.Wrap(err, errs.Info{})
	}
	return db, nil
}
Exemplo n.º 3
0
func mymysqlDriverOpener(username, password, dbName, host string, port int, connVars adapters.ConnVariables) (*sqlx.DB, error) {
	sourceString := fmt.Sprintf(
		"tcp:%s:%d,%s*%s/%s/%s",
		host, port, connVars.Join(","), dbName, username, password)
	db, stdErr := sqlx.Connect("mymysql", sourceString)
	if stdErr != nil {
		return nil, errs.Wrap(stdErr, errs.Info{})
	}
	return db, nil
}