From 5d878400e434dcce96e6f55a7ddf60303b4fd763 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Mon, 13 Apr 2020 10:30:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B3=A8=E9=87=8Asqlite=20=E9=98=B2?= =?UTF-8?q?=E6=AD=A2gcc=E9=94=99=E8=AF=AF=20=E9=9C=80=E8=A6=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E8=A1=8C=E6=89=93=E5=BC=80=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=20=E6=84=9F=E8=B0=A2=20sqlitet=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E8=80=85=20[rikugun]=20=E4=BD=9C=E8=80=85github?= =?UTF-8?q?=EF=BC=9A=20https://github.com/rikugun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/initialize/sqlite.go | 36 ++++++++++++++++++++---------------- server/main.go | 4 ++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/server/initialize/sqlite.go b/server/initialize/sqlite.go index 68315ffe..268d18a6 100644 --- a/server/initialize/sqlite.go +++ b/server/initialize/sqlite.go @@ -1,19 +1,23 @@ package initialize -import ( - "fmt" - "gin-vue-admin/global" - "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/sqlite" -) +// sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可 -//初始化数据库并产生数据库全局变量 -func Sqlite() { - admin := global.GVA_CONFIG.Sqlite - if db, err := gorm.Open("sqlite3", fmt.Sprintf("%s?%s", admin.Path,admin.Config)); err != nil { - global.GVA_LOG.Error("DEFAULTDB数据库启动异常", err) - } else { - global.GVA_DB = db - global.GVA_DB.LogMode(admin.LogMode) - } -} +// 感谢 sqlitet提供者 [rikugun] 作者github: https://github.com/rikugun + +//import ( +// "fmt" +// "gin-vue-admin/global" +// "github.com/jinzhu/gorm" +// _ "github.com/jinzhu/gorm/dialects/sqlite" +//) +// +////初始化数据库并产生数据库全局变量 +//func Sqlite() { +// admin := global.GVA_CONFIG.Sqlite +// if db, err := gorm.Open("sqlite3", fmt.Sprintf("%s?%s", admin.Path,admin.Config)); err != nil { +// global.GVA_LOG.Error("DEFAULTDB数据库启动异常", err) +// } else { +// global.GVA_DB = db +// global.GVA_DB.LogMode(admin.LogMode) +// } +//} diff --git a/server/main.go b/server/main.go index 7f97b3b8..a761e4d3 100644 --- a/server/main.go +++ b/server/main.go @@ -11,8 +11,8 @@ func main() { switch global.GVA_CONFIG.System.DbType { case "mysql": initialize.Mysql() - case "sqlite": - initialize.Sqlite() + //case "sqlite": + // initialize.Sqlite() // sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可 default: initialize.Mysql() } From b4b45e106074ac2bad7ff93105c479a77bed4de4 Mon Sep 17 00:00:00 2001 From: rainyan Date: Mon, 13 Apr 2020 10:48:14 +0800 Subject: [PATCH 2/3] update README.md You can see sample APIs in user management module. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9031d6c2..5be9405e 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ go run main.go; - Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function). - Rich text editor: Embed MarkDown editor function. - Conditional search: Add an example of conditional search. -- Restful example: refer to customer management function and apidcustomer group. +- Restful example: You can see sample APIs in user management module. ``` fontend code file: src\view\superAdmin\api\api.vue From b51e7529759bca2c69cf0f075f31d715902c8ea1 Mon Sep 17 00:00:00 2001 From: rainyan Date: Mon, 13 Apr 2020 10:51:22 +0800 Subject: [PATCH 3/3] Update README-zh_CN.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可以参考用户管理模块中的示例API。 --- README-zh_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-zh_CN.md b/README-zh_CN.md index 518d3edc..68a0bb3c 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -180,7 +180,7 @@ go run main.go; - 配置管理:配置文件可前台修改(测试环境不开放此功能)。 - 富文本编辑器:MarkDown编辑器功能嵌入。 - 条件搜索:增加条件搜索示例。 -- restful示例:参考客户管理功能,customer组api。 +- restful示例:可以参考用户管理模块中的示例API。 ``` 前端文件参考: src\view\superAdmin\api\api.vue 后台文件参考: model\dnModel\api.go