优化模版生成

This commit is contained in:
linwenxiang committed 2020-09-16 22:42:13 +08:00
1 parent 91f2adb340
commit 6bc3e6c00b
12 files changed
+53 -50

No files matched your search

+3 -3
View File
@@ -12,15 +12,15 @@ import (
func InitDb(db *gorm.DB) (err error) {
filePath := "config/db.sql"
err = ExecSql(db,filePath)
err = ExecSql(db, filePath)
if global.Driver == "postgres" {
filePath = "config/pg.sql"
err = ExecSql(db,filePath)
err = ExecSql(db, filePath)
}
return err
}
func ExecSql(db *gorm.DB,filePath string) error {
func ExecSql(db *gorm.DB, filePath string) error {
sql, err := Ioutil(filePath)
if err != nil {
fmt.Println("数据库基础数据初始化脚本读取失败!原因:", err.Error())