Releases: m-murad/ordered-sync-map
Rewrite using generics, Go Module support
- The package is now a go module and can be used as a dependency using
go get github.com/m-murad/ordered-sync-map. - The whole package has been rewritten using generics. You can declare the type of keys and variables for the map.
import (
osm "github.com/m-murad/ordered-sync-map"
)
func main() {
mp := osm.New[string, string]()
}Third release
This release adds the following -
m.GetOrPut(key interface{}, value interface{}) (finalValue interface{}, updated bool) - Retrive or Update the value for a key
m.GetAndDelete(key interface{}) (value interface{}, deleted bool) - Get value and delete the key from the Map
Second release
This release adds the following -
m.Length() - Returns the length of the Map.
Initial release
Initial release with following functions
m.New() - Will initialise a new Map.
m.Put(key interface{}, val interface{}) - Create/Update an entry in the Map.
m.Get() (value interface{}, ok bool) - Retrive value saved for a key.
m.Delete(key interface{}) bool - Delete an entry from the Map
m.UnorderedRange(f func(key interface{}, value interface{})) - Range over the Map in an unordered sequence.
m.OrderedRange(f func(key interface{}, value interface{})) - Range over the Map in the sequence in which elements were added.