测试
This commit is contained in:
parent
90871c1ab0
commit
363bd12575
|
@ -127,7 +127,13 @@ func GenFromPath(mdir string, cols []Column, tableName string, tableComment stri
|
||||||
typeName := typeForMysqlToGo[col.GetType()]
|
typeName := typeForMysqlToGo[col.GetType()]
|
||||||
var defaultString string
|
var defaultString string
|
||||||
if col.DefaultValue != nil {
|
if col.DefaultValue != nil {
|
||||||
defaultString = "default:" + *col.DefaultValue + ";"
|
switch typeName {
|
||||||
|
case "*int64", "*uint64", "*float64", "*bool":
|
||||||
|
defaultString = "default:" + strings.Trim(*col.DefaultValue, "'") + ";"
|
||||||
|
default:
|
||||||
|
defaultString = "default:" + *col.DefaultValue + ";"
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
switch typeName {
|
switch typeName {
|
||||||
|
@ -138,11 +144,11 @@ func GenFromPath(mdir string, cols []Column, tableName string, tableComment stri
|
||||||
case "*[]byte":
|
case "*[]byte":
|
||||||
defaultString = "default:'';"
|
defaultString = "default:'';"
|
||||||
case "*int64", "*uint64":
|
case "*int64", "*uint64":
|
||||||
defaultString = "default:'0';"
|
defaultString = "default:0;"
|
||||||
case "*float64":
|
case "*float64":
|
||||||
defaultString = "default:'0.0';"
|
defaultString = "default: 0.0;"
|
||||||
case "*bool":
|
case "*bool":
|
||||||
defaultString = "default:'0';"
|
defaultString = "default:0;"
|
||||||
default:
|
default:
|
||||||
fieldName = "// " + fieldName + " " + col.Type
|
fieldName = "// " + fieldName + " " + col.Type
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user