fix(goctl): fix redundant import (#2551)

This commit is contained in:
anqiansong
2022-10-25 06:58:51 +08:00
committed by GitHub
parent ce73b9a85c
commit 9504d30049
6 changed files with 24 additions and 16 deletions

View File

@@ -153,17 +153,18 @@ func ConvertDataType(dataBaseType int, isDefaultNull, unsigned, strict bool) (st
}
// ConvertStringDataType converts mysql column type into golang type
func ConvertStringDataType(dataBaseType string, isDefaultNull, unsigned, strict bool) (string, error) {
func ConvertStringDataType(dataBaseType string, isDefaultNull, unsigned, strict bool) (
goType string, isPQArray bool, err error) {
tp, ok := commonMysqlDataTypeMapString[strings.ToLower(dataBaseType)]
if !ok {
return "", fmt.Errorf("unsupported database type: %s", dataBaseType)
return "", false, fmt.Errorf("unsupported database type: %s", dataBaseType)
}
if strings.HasPrefix(dataBaseType, "_") {
return tp, nil
return tp, true, nil
}
return mayConvertNullType(tp, isDefaultNull, unsigned, strict), nil
return mayConvertNullType(tp, isDefaultNull, unsigned, strict), false, nil
}
func mayConvertNullType(goDataType string, isDefaultNull, unsigned, strict bool) string {