修复json的类型影响

This commit is contained in:
eson
2023-08-24 11:47:22 +08:00
parent 500611236e
commit d8ddad6fe9
18 changed files with 190 additions and 56 deletions

View File

@@ -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{

View File

@@ -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] != "" {