Skip to content

A golang channel based access object for shared use of a map of arbitrary objects

License

Notifications You must be signed in to change notification settings

pcrawfor/safemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

safemap

A simple wrapper around a map keyed by strings and containing arbitrary objects (interface{}) that is goroutine safe to work with.

PACKAGE DOCUMENTATION

package safemap
  import "github.com/pcrawfor/safemap"


TYPES

type SafeMap struct {
  // contains filtered or unexported fields
}


func New() *SafeMap
  NewSafeMap returns instance of SafeMap


func (m *SafeMap) GetObject(key string) (interface{}, bool)
  GetObject returns the object for the given key if one exists along with
  the boolean indicating that it was found or not

func (m *SafeMap) Keys() []string
  Keys returns all keys for the map in a slice

func (m *SafeMap) RemoveObject(key string) error
  RemoveObject removes the object for the given key

func (m *SafeMap) SetObject(key string, obj interface{}) error
  SetObject sets the given object for the given key

func (m *SafeMap) Values() []interface{}
  Values returns all the objects in the underlying map in a slice

About

A golang channel based access object for shared use of a map of arbitrary objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages