orderedmap
orderedmap copied to clipboard
orderedmap is a golang map where the keys keep the order that they're added. It can be de/serialized from/to JSON. It's based closely on the python collections.OrderedDict.
In the decode methods the nested orderedMaps had not been pointer with prevents the mutation. To the fix broke some tests the cast to x.(OrderedMap) failed. To Fix this the...
``` Added the functionality to deserialize orderedmaps into CustomTypes like `JSDict`. I added these method to my previous added OrderedMap interface: - SetKeys(keys []string) - InitValues() - Clone(v ...map[string]interface{}) OrderedMap...
Add a `Range` function for ordered traversal. I know that #8 is already opened and adds an iterator, however, this solution is both simplified and conforms to a pattern already...
how it can unmarshal yaml content?
I tried to unmarshal my json string into an orderedmap, this is my string: `"{\n \"IDs\": [\n 7236290603911250220\n ] \n}"` But I got the result:  I check the source...
This PR adds a method to reverse lookup key given a value.
This PR adds `SetUseNumber` which enables the use of [UseNumber](https://golang.org/pkg/encoding/json/#Decoder.UseNumber) to prevent precision loss when unmarshalling integers. Example usage: ``` func main() { o := orderedmap.New() o.SetUseNumber(true) json.Unmarshal([]byte(`{"x":9007199254740993}`), &o) x,...
Current implementation: ``` // add key if err := encoder.Encode(k); err != nil { return nil, err } buf.WriteByte(':') // add value if err := encoder.Encode(o.values[k]); err != nil {...
I'd love to see some benchmarks to compare this to using a regular map or just using a slice containing a `Key` and `Value`. I'd also love a little section...