直接完成
This commit is contained in:
22
dao/dao.go
Normal file
22
dao/dao.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var DB *gorm.DB
|
||||
|
||||
func Setup() {
|
||||
db, err := gorm.Open(mysql.Open(fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=utf8mb4&parseTime=True&loc=Local",
|
||||
"integrity",
|
||||
"integrity",
|
||||
"202.194.15.130",
|
||||
3306,
|
||||
"integrity")), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
DB = db
|
||||
}
|
||||
Reference in New Issue
Block a user