support sqlite

支持sqlite
This commit is contained in:
谢小军
2020-09-22 19:23:36 +08:00
parent 9893478fa8
commit 36b6de2a7b
18 changed files with 551 additions and 65 deletions

View File

@@ -13,7 +13,7 @@ import (
"gopkg.in/go-playground/validator.v9"
)
var mysqlInfo config.MysqlDbInfo
var mysqlInfo config.DBInfo
var outDir string
var singularTable bool
var foreignKey bool
@@ -78,20 +78,20 @@ func init() {
func initConfig() {
MergeMysqlDbInfo()
validate := validator.New()
err := validate.Struct(config.GetMysqlDbInfo())
err := validate.Struct(config.GetDbInfo())
if err != nil {
mylog.Info("Can't read cmd: using -h, --help) to get more info")
mylog.Error(err)
os.Exit(1)
} else {
mylog.Info("using database info:")
mylog.JSON(config.GetMysqlDbInfo())
mylog.JSON(config.GetDbInfo())
}
}
// MergeMysqlDbInfo merge parm
func MergeMysqlDbInfo() {
var tmp = config.GetMysqlDbInfo()
var tmp = config.GetDbInfo()
if len(mysqlInfo.Database) > 0 {
tmp.Database = mysqlInfo.Database
}