MCPcopy
hub / github.com/zeromicro/go-zero / checkDuplicateUniqueIndex

Function checkDuplicateUniqueIndex

tools/goctl/model/sql/parser/parser.go:174–192  ·  view source on GitHub ↗
(uniqueIndex map[string][]*Field, tableName string)

Source from the content-addressed store, hash-verified

172}
173
174func checkDuplicateUniqueIndex(uniqueIndex map[string][]*Field, tableName string) {
175 log := console.NewColorConsole()
176 uniqueSet := collection.NewSet[string]()
177 for k, i := range uniqueIndex {
178 var list []string
179 for _, e := range i {
180 list = append(list, e.Name.Source())
181 }
182
183 joinRet := strings.Join(list, ",")
184 if uniqueSet.Contains(joinRet) {
185 log.Warning("[checkDuplicateUniqueIndex]: table %s: duplicate unique index %s", tableName, joinRet)
186 delete(uniqueIndex, k)
187 continue
188 }
189
190 uniqueSet.Add(joinRet)
191 }
192}
193
194func convertColumns(columns []*parser.Column, primaryColumn string, strict bool) (Primary, map[string]*Field, error) {
195 var (

Callers 1

ParseFunction · 0.85

Calls 7

NewColorConsoleFunction · 0.92
deleteFunction · 0.85
SourceMethod · 0.80
JoinMethod · 0.80
WarningMethod · 0.65
AddMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…