2 Star 1 Fork 1

mosache/YFrame

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
db.go 451 Bytes
Copy Edit Raw Blame History
ヤ沒脩袮兲︶ authored 2023-03-15 18:07 . init
package db
import (
"fmt"
"gitee.com/mosache/YFrame/tools/Y/model/conf"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
var (
DB *gorm.DB
)
func InitDB(conf *conf.Configuration) error {
var (
dsn string
err error
)
dsn = fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8", conf.UserName,
conf.Password, conf.Host, conf.Port, conf.DataBase)
DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
if err != nil {
return err
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mosache/YFrame.git
git@gitee.com:mosache/YFrame.git
mosache
YFrame
YFrame
v0.1.30

Search

0d507c66 1850385 C8b1a773 1850385