diff --git a/tools/goctl/model/sql/gen/field.go b/tools/goctl/model/sql/gen/field.go index 86301688..a35c7332 100644 --- a/tools/goctl/model/sql/gen/field.go +++ b/tools/goctl/model/sql/gen/field.go @@ -38,7 +38,7 @@ func genField(table Table, field *parser.Field) (string, error) { output, err := util.With("types"). Parse(text). Execute(map[string]interface{}{ - "name": field.Name.ToCamel(), + "name": util.SafeString(field.Name.ToCamel()), "type": field.DataType, "tag": tag, "hasComment": field.Comment != "", diff --git a/tools/goctl/model/sql/gen/insert.go b/tools/goctl/model/sql/gen/insert.go index 36cfe8e1..1ab93069 100644 --- a/tools/goctl/model/sql/gen/insert.go +++ b/tools/goctl/model/sql/gen/insert.go @@ -30,7 +30,7 @@ func genInsert(table Table, withCache, postgreSql bool) (string, string, error) expressionValues := make([]string, 0) var count int for _, field := range table.Fields { - camel := field.Name.ToCamel() + camel := util.SafeString(field.Name.ToCamel()) if camel == "CreateTime" || camel == "UpdateTime" { continue } diff --git a/tools/goctl/model/sql/gen/update.go b/tools/goctl/model/sql/gen/update.go index 57ce3625..189eea78 100644 --- a/tools/goctl/model/sql/gen/update.go +++ b/tools/goctl/model/sql/gen/update.go @@ -14,7 +14,7 @@ import ( func genUpdate(table Table, withCache, postgreSql bool) (string, string, error) { expressionValues := make([]string, 0) for _, field := range table.Fields { - camel := field.Name.ToCamel() + camel := util.SafeString(field.Name.ToCamel()) if camel == "CreateTime" || camel == "UpdateTime" { continue }