habibimustafa / collection

Golang Collection Module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

collection

Golang Collection Module is a helper for managing array, slice and map.

Usage

go get github.com/habibimustafa/collection

Example

arrString := []string{"Hello", "World", "Are", "You", "Ready"}
strCollection := Collect(arrString)

strCollection.Size()
strCollection.Contains(0, "Hello")
strCollection.Keys().Size()
strCollection.Values().Has("Ready")
arrMap = map[string]interface{}{"First Name": "John", "Last Name": "Doe", "Age": 28}
mapCollection := Collect(arrMap)

mapCollection.Size()
mapCollection.Contains("First Name", "John")
mapCollection.Keys().All().Map(...)
mapCollection.Values().Has("Ready")

For more usage examples please see the test files.

About

Golang Collection Module

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%