7 Star 1 Fork 1

罗中天 / douyin

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
init.go 671 Bytes
Copy Edit Raw Blame History
luozhongtian02 authored 2023-02-08 20:14 . feat: 视频相关接口实现
package db
import (
"gitee.com/derrickball/douyin/pkg/config"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
"os"
"time"
)
var DB *gorm.DB
func Init() {
newLogger := logger.New(
log.New(os.Stdout, "\r\n", log.LstdFlags), // io writer
logger.Config{
SlowThreshold: time.Second, // 慢 SQL 阈值
LogLevel: logger.Silent, // Log level
Colorful: false, // 禁用彩色打印
},
)
var err error
DB, err = gorm.Open(mysql.Open(config.Config.MySQL.DSN), &gorm.Config{
SkipDefaultTransaction: true,
PrepareStmt: true,
Logger: newLogger,
})
if err != nil {
panic(err)
}
}
1
https://gitee.com/derrickball/douyin.git
git@gitee.com:derrickball/douyin.git
derrickball
douyin
douyin
48d44dfe16fa

Search

53164aa7 5694891 3bd8fe86 5694891