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

@@ -1,14 +1,17 @@
package dlg
import (
"fmt"
"os/exec"
"github.com/jroimartin/gocui"
"github.com/xxjwxc/gormt/data/view/model"
"github.com/xxjwxc/gormt/data/view/model/genmysql"
"github.com/xxjwxc/gormt/data/view/model/gensqlite"
"github.com/xxjwxc/gormt/data/config"
"github.com/xxjwxc/public/mylog"
"github.com/xxjwxc/public/tools"
)
@@ -72,7 +75,18 @@ func getBool(bstr string) bool {
}
func generate(g *gocui.Gui, v *gocui.View) {
modeldb := genmysql.GetMysqlModel()
var modeldb model.IModel
switch config.GetDbInfo().Type {
case 0:
modeldb = genmysql.GetModel()
case 1:
modeldb = gensqlite.GetModel()
}
if modeldb == nil {
mylog.Error(fmt.Errorf("modeldb not fund : please check db_info.type (0:mysql , 1:sqlite , 2:mssql) "))
return
}
pkg := modeldb.GenModel()
// just for test
// out, _ := json.Marshal(pkg)