The simplest solution may be to do filtering in-line, looping through your set of records and discarding whatever records don’t match your business requirements
Choosing a filtering library comes at cost though — libraries have to be type-agnostic and thus will generally be using reflect under the hood to do type assertions which is not ideal for performance. 关于filtering库的一个实现思路
1 | // Filter is a filter function applied to a single record. |
1 | // ApplyFilters applies a set of filters to a record list. |