mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 11:48:56 +00:00
23 lines
410 B
Go
23 lines
410 B
Go
|
package storage
|
||
|
|
||
|
import (
|
||
|
. "server/common"
|
||
|
|
||
|
_ "github.com/go-sql-driver/mysql"
|
||
|
"github.com/jmoiron/sqlx"
|
||
|
"go.uber.org/zap"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
MySQLManagerIns *sqlx.DB
|
||
|
)
|
||
|
|
||
|
func initMySQL() {
|
||
|
var err error
|
||
|
MySQLManagerIns, err = sqlx.Connect("mysql", Conf.MySQL.DSN+"?charset=utf8mb4")
|
||
|
ErrFatal(err)
|
||
|
err = MySQLManagerIns.Ping()
|
||
|
ErrFatal(err)
|
||
|
Logger.Info("MySQLManagerIns", zap.Any("mysql", MySQLManagerIns))
|
||
|
}
|