Skip to content

Commit c0cbfd1

Browse files
committed
modify ColumnList creation
1 parent 720f685 commit c0cbfd1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

go/sql/types.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,13 @@ func (this *ColumnList) IsSubsetOf(other *ColumnList) bool {
246246
}
247247

248248
func (this *ColumnList) FilterBy(f func(Column) bool) *ColumnList {
249-
filteredList := &ColumnList{}
250-
filteredList.Ordinals = this.Ordinals
251-
filteredCols := []Column{}
249+
filteredCols := make([]Column, 0, len(this.columns))
252250
for _, column := range this.columns {
253251
if f(column) {
254252
filteredCols = append(filteredCols, column)
255253
}
256254
}
257-
filteredList.columns = filteredCols
258-
return filteredList
255+
return &ColumnList{Ordinals: this.Ordinals, columns: filteredCols}
259256
}
260257

261258
func (this *ColumnList) Len() int {

0 commit comments

Comments
 (0)