Skip to content

tears-of-noobs/zhash

 
 

Repository files navigation

zhash

Bored of type switches when dealing with huge nested maps? zhash is for you!

Create one

import zhash

func main() {
    hash := zhash.NewHash()
}

Then fill it from toml:

    func tomlUnmarshal(b []byte, v interface{}) error {
	    _, err := toml.Decode(string(b), v)
	    return err
    }

    hash.SetUnmarshaller(tomlUnmarshal)
    hash.ReadHash(reader)

or initialize from existing map[string]interface{}:

    hash := zhash.HashFromMap(yourFancyMap)

And use it through different getters and setters:

    s, _ := hash.GetString("path", "to", "nested", "item")

    hash.Set("Some new var", "path", "to", "existing", "or", "new", "element")

All the things is in dev branch still.

About

Hash type for manipulation with huge map[string]interface{}

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%