Go 语言中的 collect 使用
Go语言中的collect使用
首先下载 github.com/chenhg5/collection
包
使用方法如下
var name = "王经理"
all := customerAll() //为一个[]map[string]interface{}
a := collection.Collect(all).Pluck("user_name").Filter(func(item, value interface{}) bool {
if value == name {
return true
} else {
return false
}
}).First()
g.Dump(a)
文档地址,里面挺多操作的
https://godoc.org/github.com/chenhg5/colle...
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: