package sqldb import ( "database/sql" "log" _ "github.com/go-sql-driver/mysql" _ "github.com/mattn/go-sqlite3" ) func ConnectSQLite(file string) *sql.DB { db, err := sql.Open("sqlite3", file) if err != nil { log.Fatal(err) } return db } func ConnectMysql(connection string) *sql.DB { db, err := sql.Open("mysql", connection) if err != nil { log.Fatal(err) } err = db.Ping() // handle error if err != nil { log.Fatal(err) } return db }