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

@@ -5,6 +5,7 @@ import (
"sort"
"github.com/tal-tech/go-zero/core/stores/sqlx"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/util"
)
const indexPri = "PRIMARY"
@@ -151,6 +152,7 @@ func (c *ColumnData) Convert() (*Table, error) {
m := make(map[string][]*Column)
for _, each := range c.Columns {
each.Comment = util.TrimNewLine(each.Comment)
if each.Index != nil {
m[each.Index.IndexName] = append(m[each.Index.IndexName], each)
}