修复json的类型影响
This commit is contained in:
@@ -14,6 +14,7 @@ func TestXMain(t *testing.T) {
|
||||
for _, line := range re.FindStringSubmatch(a) {
|
||||
log.Println(line)
|
||||
}
|
||||
|
||||
log.Println(re.FindStringSubmatch(a))
|
||||
// testGenDir = "../" + testGenDir
|
||||
// GenAllModels(testGenDir, TableNameComment{
|
||||
|
||||
@@ -229,6 +229,10 @@ func main() {
|
||||
if name == "-" {
|
||||
tablenames := GetAllTableNames(mysqluri)
|
||||
for _, testName := range tablenames {
|
||||
// if testName != "fs_user_info" {
|
||||
// continue
|
||||
// }
|
||||
|
||||
cols, tname, tcomment := GetColsFromTable(testName, db)
|
||||
GenFromPath(testGenDir, cols, tname, tcomment)
|
||||
|
||||
@@ -288,7 +292,6 @@ func GenFromPath(mdir string, cols []Column, tableName string, tableComment stri
|
||||
default:
|
||||
defaultString = "default:" + *col.DefaultValue + ";"
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
switch typeName {
|
||||
@@ -305,6 +308,9 @@ func GenFromPath(mdir string, cols []Column, tableName string, tableComment stri
|
||||
case "*bool":
|
||||
defaultString = "default:0;"
|
||||
default:
|
||||
// if fieldName == "Metadata" {
|
||||
// log.Println()
|
||||
// }
|
||||
fieldName = "// " + fieldName + " " + col.Type
|
||||
}
|
||||
}
|
||||
@@ -508,6 +514,10 @@ func ParserDDL(ddl string) (result []Column, tableName, tableComment string) {
|
||||
Type: strings.ToLower(m[2]),
|
||||
}
|
||||
|
||||
if col.Type == "json" {
|
||||
col.Type = "blob"
|
||||
}
|
||||
|
||||
col.IndexType = fieldmap[col.Name]
|
||||
|
||||
if m[3] != "" {
|
||||
|
||||
Reference in New Issue
Block a user