0 Star 0 Fork 0

shallot / Go开发工具集

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
connect_sqlite.go 434 Bytes
一键复制 编辑 原始数据 按行查看 历史
package dbtool
import (
"github.com/jinzhu/gorm"
)
// SQLite的配置信息
type SqliteConfig struct {
Filepath string // 文件地址
Password string // 调试时数据库密码
DebugMode bool // 开启SQL调试模式
}
// 获取SQLite数据库连接
func ConnectSqlite(config SqliteConfig) (db *gorm.DB, err error) {
// 数据库连接
db, err = gorm.Open("sqlite3", config.Filepath+"?_key="+config.Password)
return
}
Go
1
https://gitee.com/gxsshallot/gotool.git
git@gitee.com:gxsshallot/gotool.git
gxsshallot
gotool
Go开发工具集
2324c52c6c14

搜索帮助

53164aa7 5694891 3bd8fe86 5694891