syncmap

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncMap

type SyncMap struct {
	*sync.Map
}

SyncMap is a thread-safe map.

func NewSyncMap

func NewSyncMap() *SyncMap

NewSyncMap returns a new SyncMap.

func (*SyncMap) Add

func (mmap *SyncMap) Add(key string, value interface{}) error

Add adds a key-value pair into the *sync.Map. The ErrEmptyValue error will be returned if the key is empty.

func (*SyncMap) Get

func (mmap *SyncMap) Get(key string) (interface{}, error)

Get returns result as interface{} according to the key. The ErrEmptyValue error will be returned if the key is empty. And the ErrDataNotFound error will be returned if the key cannot be found.

func (*SyncMap) GetAsAtomicInt

func (mmap *SyncMap) GetAsAtomicInt(key string) (*atomiccount.AtomicInt, error)

GetAsAtomicInt returns result as *AtomicInt. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsBitset

func (mmap *SyncMap) GetAsBitset(key string) (*bitset.BitSet, error)

GetAsBitset returns result as *bitset.BitSet. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsBool

func (mmap *SyncMap) GetAsBool(key string) (bool, error)

GetAsBool returns result as bool. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsInt

func (mmap *SyncMap) GetAsInt(key string) (int, error)

GetAsInt returns result as int. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsInt64 added in v1.0.0

func (mmap *SyncMap) GetAsInt64(key string) (int64, error)

GetAsInt64 returns result as int64. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsMap

func (mmap *SyncMap) GetAsMap(key string) (*SyncMap, error)

GetAsMap returns result as SyncMap. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsString

func (mmap *SyncMap) GetAsString(key string) (string, error)

GetAsString returns result as string. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) GetAsTime added in v1.0.0

func (mmap *SyncMap) GetAsTime(key string) (time.Time, error)

GetAsTime returns result as Time. The ErrConvertFailed error will be returned if the assertion fails.

func (*SyncMap) ListKeyAsIntSlice

func (mmap *SyncMap) ListKeyAsIntSlice() (result []int)

ListKeyAsIntSlice returns the list of keys as an int slice.

func (*SyncMap) ListKeyAsStringSlice

func (mmap *SyncMap) ListKeyAsStringSlice() (result []string)

ListKeyAsStringSlice returns the list of keys as a string slice.

func (*SyncMap) Remove

func (mmap *SyncMap) Remove(key string) error

Remove deletes the key-value pair from the mmap. The ErrEmptyValue error will be returned if the key is empty. And the ErrDataNotFound error will be returned if the key cannot be found.

Jump to

Keyboard shortcuts

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