添加ui界面

This commit is contained in:
谢小军
2020-01-21 22:31:08 +08:00
parent bb224315a1
commit 5230c6f242
12 changed files with 277 additions and 63 deletions

View File

@@ -3,13 +3,18 @@ package genmysql
import (
"strings"
"github.com/xxjwxc/gormt/data/config"
"github.com/xxjwxc/gormt/data/view/model"
)
// filterModel filter.过滤 gorm.Model
func filterModel(list *[]genColumns) bool {
var _temp []genColumns
if config.GetDBTag() != "gorm" {
return false
}
var _temp []genColumns
num := 0
for _, v := range *list {
if strings.EqualFold(v.Field, "id") ||
@@ -41,3 +46,9 @@ func fixForeignKey(list []genForeignKey, columuName string, result *[]model.Fore
}
}
}
// GetMysqlModel get model interface. 获取model接口
func GetMysqlModel() model.IModel {
//now just support mysql
return &MySQLModel
}

View File

@@ -169,7 +169,9 @@ func getTables(orm *mysqldb.MySqlDB) map[string]string {
rows, err := orm.Raw("show tables").Rows()
if err != nil {
fmt.Println(err)
if !config.GetIsGUI() {
fmt.Println(err)
}
return tbDesc
}
@@ -184,7 +186,9 @@ func getTables(orm *mysqldb.MySqlDB) map[string]string {
// Get table annotations.获取表注释
rows1, err := orm.Raw("SELECT TABLE_NAME,TABLE_COMMENT FROM information_schema.TABLES WHERE table_schema= '" + config.GetMysqlDbInfo().Database + "'").Rows()
if err != nil {
fmt.Println(err)
if !config.GetIsGUI() {
fmt.Println(err)
}
return tbDesc
}