package db import ( "database/sql" _ "github.com/go-sql-driver/mysql" ) func ConnectMySQL(dsn string) (*sql.DB, error) { if dsn == "" { return sql.Open("mysql", "invalid:invalid@tcp(localhost:3306)/invalid") } db, err := sql.Open("mysql", dsn) if err != nil { return nil, err } return db, nil }