Skip to content

gford1000-go/syncmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Doc Go Report Card

syncmap

SynchronisedMap provides a simple implementation of a concurrency safe map.

The map supports the usual operations, with Insert() operating as both Add and Update.

Maps can be serialised to []byte and then this slice merged into another map instance. Merge will only insert values for missing keys, so that the receiving map's existing state is not affected.

func main() {
	c := New(map[string]int{"x": 0, "y": 0})

	c.Insert("z", 1, false)

	c.Remove("y")

	fmt.Println(c)
	// Output: map[x:0 z:1]
}

About

Simple implementation of a concurrency safe Map

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages