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:
Kristin Laemmert
2024-08-07 08:34:52 -04:00
committed by GitHub
parent 9b652612bd
commit a117b090cf
4 changed files with 6 additions and 6 deletions

View File

@ -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])
}