修复代码生成BUG

This commit is contained in:
白茶清欢 2024-04-14 21:56:30 +08:00
parent 1e720ff9a3
commit fcb092cece

View File

@ -21,9 +21,9 @@ const (
// TableColumnTpl 每个字段的模版
TableColumnTpl = " {FIELD} string `json:\"{JSON_TAG}\"`"
// TableColumnDescTpl 字段描述
TableColumnDescTpl = " {FIELD}: \"{JSON_TAG}\"`"
TableColumnDescTpl = " {FIELD}: \"{JSON_TAG}\""
// TableColumnCommentTpl 字段描述
TableColumnCommentTpl = " \"{JSON_TAG}\": \"{FIELD_COMMENT}\"`"
TableColumnCommentTpl = " \"{JSON_TAG}\": \"{FIELD_COMMENT}\""
)
// BasicTableInfo ...
@ -79,6 +79,7 @@ func ParseCreateTableSql(sql string) (*BasicTableInfo, error) {
columnDefined, _, getColumnFunc := generateTableColumnDefined(basic.ModelStructName, r.TableSpec.Columns)
basic.ColumnDescDefined = columnDefined
basic.ModelStruct += getColumnFunc
basic.ModelStruct = basic.ColumnDefined + `\n` + basic.ModelStruct
return basic, nil
}