提交 66393b35 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

增加对sqlite数据库的支持 默认模式为mysql数据库

上级 7ece1dba
......@@ -39,7 +39,7 @@ system:
use-multipoint: false
env: 'public' # Change to "develop" to skip authentication for development mode
addr: 8888
db-type: sqlite
db-type: "mysql"
# captcha configuration
captcha:
......
......@@ -2,7 +2,7 @@ package config
type Server struct {
Mysql Mysql `mapstructure:"mysql" json:"mysql"`
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite"`
Sqlite Sqlite `mapstructure:"sqlite" json:"sqlite"`
Qiniu Qiniu `mapstructure:"qiniu" json:"qiniu"`
Casbin Casbin `mapstructure:"casbin" json:"casbin"`
Redis Redis `mapstructure:"redis" json:"redis"`
......@@ -16,7 +16,7 @@ type System struct {
UseMultipoint bool `mapstructure:"use-multipoint" json:"useMultipoint"`
Env string `mapstructure:"env" json:"env"`
Addr int `mapstructure:"addr" json:"addr"`
DbType string `mapstructure:"db-type" json:"dbType"`
DbType string `mapstructure:"db-type" json:"dbType"`
}
type JWT struct {
......@@ -62,9 +62,9 @@ type Log struct {
}
type Sqlite struct {
Username string `mapstructure:"username" json:"username"`
Password string `mapstructure:"password" json:"password"`
Path string `mapstructure:"path" json:"path"`
Config string `mapstructure:"config" json:"config"`
LogMode bool `mapstructure:"log-mode" json:"logMode"`
Username string `mapstructure:"username" json:"username"`
Password string `mapstructure:"password" json:"password"`
Path string `mapstructure:"path" json:"path"`
Config string `mapstructure:"config" json:"config"`
LogMode bool `mapstructure:"log-mode" json:"logMode"`
}
......@@ -8,11 +8,13 @@ import (
)
func main() {
switch global.GVA_CONFIG.System.DbType {
switch global.GVA_CONFIG.System.DbType {
case "mysql":
initialize.Mysql()
case "sqlite":
initialize.Sqlite()
default:
initialize.Mysql()
}
initialize.DBTables()
// 程序结束前关闭数据库链接
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册