GoCollection
Simple key:value based utility data structure for golang!
Quick Example
First install the package!
go get github.com/scientific-dev/gocollection
In your golang file!
package main
import "fmt"
import collection "github.com/scientific-dev/gocollection"
func main() {
col := collection.Collection()
col.Set("foo", "bar")
fmt.Println(col.Get("foo")) // Will return "bar"
}
It is basically a better version of map
in golang! GoCollection uses map[string]interface{}
as a map typing!
Storing structs
So incase if you are not aware how to store structs using this, here is quick tuto
package main
import "fmt"
import collection "github.com/scientific-dev/gocollection"
type SimpleStruct struct{
field string
}
func main() {
col := collection.Collection()
col.Set("foo", SimpleStruct{ field: "string" })
fmt.Println(col.Get("foo").(SimpleStruct).field) // You can use the basic type conversion of golang for this!
}
Support
Any kind of doubts on this package, you can make an issue in the github repo or join our discord server and ask us doubts!
Discord Server: https://discord.gg/FrduEZd
GitHub Repo: https://github.com/scientific-dev/gocollection/
Docs: https://github.com/scientific-dev/gocollection/wiki/Go-Collection
Golang: https://pkg.go.dev/github.com/scientific-dev/gocollection