From c0cbfd15e8e4acb235bc71cd14f30bb6f3056ef6 Mon Sep 17 00:00:00 2001 From: meiji163 Date: Wed, 18 Dec 2024 15:39:33 -0800 Subject: [PATCH] modify ColumnList creation --- go/sql/types.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/go/sql/types.go b/go/sql/types.go index 894b9277d..f7aac5f5f 100644 --- a/go/sql/types.go +++ b/go/sql/types.go @@ -246,16 +246,13 @@ func (this *ColumnList) IsSubsetOf(other *ColumnList) bool { } func (this *ColumnList) FilterBy(f func(Column) bool) *ColumnList { - filteredList := &ColumnList{} - filteredList.Ordinals = this.Ordinals - filteredCols := []Column{} + filteredCols := make([]Column, 0, len(this.columns)) for _, column := range this.columns { if f(column) { filteredCols = append(filteredCols, column) } } - filteredList.columns = filteredCols - return filteredList + return &ColumnList{Ordinals: this.Ordinals, columns: filteredCols} } func (this *ColumnList) Len() int {