support sqlite
支持sqlite
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package gtools
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
|
||||
"github.com/xxjwxc/public/mylog"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
"github.com/xxjwxc/gormt/data/config"
|
||||
|
||||
"github.com/xxjwxc/gormt/data/view/model/genmysql"
|
||||
"github.com/xxjwxc/gormt/data/view/model/gensqlite"
|
||||
"github.com/xxjwxc/public/tools"
|
||||
)
|
||||
|
||||
@@ -28,8 +30,20 @@ func showCmd() {
|
||||
// tt.Nickname = "ticket_001"
|
||||
// orm.Where("nickname = ?", "ticket_001").Find(&tt)
|
||||
// fmt.Println(tt)
|
||||
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()
|
||||
// gencnf.GenOutPut(&pkg)
|
||||
// just for test
|
||||
// out, _ := json.Marshal(pkg)
|
||||
// tools.WriteFile("test.txt", []string{string(out)}, true)
|
||||
|
||||
Reference in New Issue
Block a user