提交 b2018759 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

get mysql column type

上级 cf73be9a
......@@ -4,7 +4,7 @@ CREATE TABLE `biz_project` (
`created_at` datetime(3) DEFAULT NULL,
`updated_at` datetime(3) DEFAULT NULL,
`deleted_at` datetime(3) DEFAULT NULL,
`name` longtext,
`name` varchar,
`desc` longtext,
`is_default` longtext,
`disabled` tinyint(1) DEFAULT NULL,
......
......@@ -177,12 +177,14 @@ func (s *SqlParseService) getFieldTypeAndName(item []string) (typ, name string)
myExp := regexp.MustCompile(colName + `\s([A-Z]+)\(([^,]*),?([^,]*)\)`)
result := myExp.FindStringSubmatch(item[0])
if result != nil {
if result != nil { // int with (10)
typ = result[1]
} else {
typ = strings.Split(strings.Fields(item[0])[1], "(")[0]
}
typ = strings.TrimSuffix(typ, ",")
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册