mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
15 lines
269 B
Go
15 lines
269 B
Go
package cmdutil
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func ConnectMySQL() (*sqlx.DB, error) {
|
|
mysqlURL := viper.GetString("mysql-url")
|
|
mysqlURL = fmt.Sprintf("%s?parseTime=true", mysqlURL)
|
|
return sqlx.Connect("mysql", mysqlURL)
|
|
}
|