chore: preallocate slices where we have a good idea of requirements (#91596)
* chore: preallocate slices where we have a good idea of requirements * pr feedback
This commit is contained in:
@@ -1096,10 +1096,10 @@ func (db *postgres) GetTables() ([]*core.Table, error) {
|
||||
}
|
||||
|
||||
func getIndexColName(indexdef string) []string {
|
||||
var colNames []string
|
||||
|
||||
cs := strings.Split(indexdef, "(")
|
||||
for _, v := range strings.Split(strings.Split(cs[1], ")")[0], ",") {
|
||||
splitNames := strings.Split(strings.Split(cs[1], ")")[0], ",")
|
||||
colNames := make([]string, 0, len(splitNames))
|
||||
for _, v := range splitNames {
|
||||
colNames = append(colNames, strings.Split(strings.TrimLeft(v, " "), " ")[0])
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ func eraseAny(value string, strToErase ...string) string {
|
||||
if len(strToErase) == 0 {
|
||||
return value
|
||||
}
|
||||
var replaceSeq []string
|
||||
replaceSeq := make([]string, 0, len(strToErase)*2)
|
||||
for _, s := range strToErase {
|
||||
replaceSeq = append(replaceSeq, s, "")
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ func (statement *Statement) genUniqueSQL() []string {
|
||||
}
|
||||
|
||||
func (statement *Statement) genDelIndexSQL() []string {
|
||||
var sqls []string
|
||||
sqls := make([]string, 0, len(statement.RefTable.Indexes))
|
||||
tbName := statement.TableName()
|
||||
idxPrefixName := strings.Replace(tbName, `"`, "", -1)
|
||||
idxPrefixName = strings.Replace(idxPrefixName, `.`, "_", -1)
|
||||
|
||||
Reference in New Issue
Block a user