Optimize model nl (#686)

This commit is contained in:
anqiansong
2021-05-12 12:28:23 +08:00
committed by GitHub
parent a87978568a
commit ea01cc78f0
5 changed files with 40 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/tal-tech/go-zero/core/collection"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/converter"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/model"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/util"
"github.com/tal-tech/go-zero/tools/goctl/util/console"
"github.com/tal-tech/go-zero/tools/goctl/util/stringx"
"github.com/xwb1989/sqlparser"
@@ -185,7 +186,7 @@ func convertColumns(columns []*sqlparser.ColumnDefinition, primaryColumn string)
field.Name = stringx.From(column.Name.String())
field.DataBaseType = column.Type.Type
field.DataType = dataType
field.Comment = comment
field.Comment = util.TrimNewLine(comment)
if field.Name.Source() == primaryColumn {
primaryKey = Primary{