From 2cbffbd8832a5d64a87dfc2ae404d64e48ce609a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 25 Nov 2025 11:55:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=87=E6=BB=A4=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- op_array/util.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/op_array/util.go b/op_array/util.go index 9d229a0..29854f6 100644 --- a/op_array/util.go +++ b/op_array/util.go @@ -26,3 +26,14 @@ func ExtractField[FieldValue any, Value any](dataList []Value, fieldValue func(i } return res } + +// Filter 过滤列表数据 +func Filter[Value any](dataList []Value, filterValue func(item Value) bool) []Value { + res := make([]Value, 0) + for _, item := range dataList { + if filterValue(item) { + res = append(res, item) + } + } + return res +}