Top 0.9% dependent packages on proxy.golang.org
Top 1.1% dependent repos on proxy.golang.org
Top 9.9% forks on proxy.golang.org
Top 1.8% docker downloads on proxy.golang.org
proxy.golang.org : github.com/zazab/zhash
Package zhash gives you the tool to operate huge map[string]interface{} with pleasure. There are two methods to create new Hash. First, you can create Hash from existing map[string]interface{} using HashFromMap(m) function: Or you can create an empty hash by NewHash() function. Then you can fill it via Set, or you can set any function fiting the Unmarshaller type, and read your hash from any reader (file or bytes.Buffer, for example). So, you have your hash. How can you access it's data? It's simple --- use Get<Type> for getting single items, Get<Type>Slice for getting slices, Set for changing items, Delete for deleting childs of nested (or not) maps, and Append<Type>Slice for appending slices. Set make no difference on what was there before setting new value. So, you can easily replace any map with int, and loose all underlying data. Also Set creates all needed parents if needed, and replaces any found element in the way by map[string]interface{}. So be double careful with Set. Append<Type>Slice will succeed if Get<Type>Slice return no err, or err is not found error. Append<Type>Slice replaces original slice, so, for example, if original slice "some.slice" was []interface{} containing only ints, and you do AppendIntSlice, after append "some.slice" would become []int64. Example HashFromMap shows how to initialize your hash from map Example ReadHash shows how to initialize your hash using Unmarshal function You can use any function that satisfies Unmarshaller type for ReadHash. For example, see TomlExample for example of using BurntSushi/toml for unmarshalling
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/zazab/zhash
License: MIT
Latest release: over 2 years ago
First release: over 2 years ago
Namespace: github.com/zazab
Dependent packages: 30
Dependent repositories: 26
Stars: 19 on GitHub
Forks: 3 on GitHub
Docker dependents: 1
Docker downloads: 29
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago