4 Star 6 Fork 3

王军 / golib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mysql.go 469 Bytes
一键复制 编辑 原始数据 按行查看 历史
王军 提交于 2022-08-19 16:36 . 增加常用的数据库获取
/*
* @Author: Wangjun
* @Date: 2022-08-19 16:20:35
* @LastEditTime: 2022-08-19 16:20:58
* @LastEditors: Wangjun
* @Description:
* @FilePath: \golib\gdb\mysql.go
* hnxr
*/
package gdb
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/schema"
)
func GetMysql(dsn string) (db *gorm.DB, err error) {
return gorm.Open(mysql.Open(dsn), &gorm.Config{
NamingStrategy: schema.NamingStrategy{
SingularTable: true,
},
})
}
Go
1
https://gitee.com/haodreams/golib.git
git@gitee.com:haodreams/golib.git
haodreams
golib
golib
956c397b13ee

搜索帮助