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 协议》,转载必须注明作者和本文链接
994914376
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!