safemap

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package safemap implements a map like container with rw lock to keep groutine safety.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeMap

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

SafeMap is a type like map with rw lock.

func New

func New() *SafeMap

New creates a SafeMap.

func (*SafeMap) Clear

func (m *SafeMap) Clear()

Clear the map.

func (*SafeMap) Delete

func (m *SafeMap) Delete(key interface{}) bool

Delete a value from map by key.

func (*SafeMap) Get

func (m *SafeMap) Get(key interface{}) (interface{}, bool)

Get value from map by key.

func (*SafeMap) Has

func (m *SafeMap) Has(key interface{}) bool

Has checks if a key is in map.

func (*SafeMap) Items

func (m *SafeMap) Items() map[interface{}]interface{}

Items returns all items in the map.

func (*SafeMap) Len

func (m *SafeMap) Len() int

Len returns map length.

func (*SafeMap) Pop

func (m *SafeMap) Pop(key interface{}) (interface{}, bool)

Pop a value from map by key.

func (*SafeMap) Set

func (m *SafeMap) Set(key, val interface{})

Set value to map by key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL