collection icon indicating copy to clipboard operation
collection copied to clipboard

where的使用

Open hubyao opened this issue 5 years ago • 1 comments

请问想进行where的条件筛选怎么做 func TestBaseCollection_Where(t *testing.T) { a := []map[string]interface{}{ {"name": "mike", "sex": 0}, {"name": "Mary", "sex": 1}, {"name": "Jane", "sex": 2}, }

fmt.Println(Collect(a).Where("sex", 1).ToMapArray())

}

比如想筛选sex大于1的数据

hubyao avatar Sep 21 '19 07:09 hubyao

@stepGitHub 已修复。更新下master最新代码。

fmt.Println(Collect(a).Where("sex", ">", 1).ToMapArray())

chenhg5 avatar Sep 21 '19 07:09 chenhg5