Documentation ¶
Index ¶
- type SyncMap
- func (mmap *SyncMap) Add(key string, value interface{}) error
- func (mmap *SyncMap) Get(key string) (interface{}, error)
- func (mmap *SyncMap) GetAsAtomicInt(key string) (*atomic.Int32, error)
- func (mmap *SyncMap) GetAsBool(key string) (bool, error)
- func (mmap *SyncMap) GetAsInt(key string) (int, error)
- func (mmap *SyncMap) GetAsInt64(key string) (int64, error)
- func (mmap *SyncMap) GetAsList(key string) (*list.List, error)
- func (mmap *SyncMap) GetAsMap(key string) (*SyncMap, error)
- func (mmap *SyncMap) GetAsString(key string) (string, error)
- func (mmap *SyncMap) GetAsTime(key string) (time.Time, error)
- func (mmap *SyncMap) ListKeyAsIntSlice() (result []int)
- func (mmap *SyncMap) ListKeyAsStringSlice() (result []string)
- func (mmap *SyncMap) Remove(key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SyncMap ¶
SyncMap is a thread-safe map providing generic support
func (*SyncMap) Add ¶
Add adds a key-value pair into the *sync.Map. The ErrEmptyValue error will be returned if the key is empty.
func (*SyncMap) Get ¶
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 ¶
GetAsAtomicInt returns result as *AtomicInt. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsBool ¶
GetAsBool returns result as bool. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsInt ¶
GetAsInt returns result as int. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsInt64 ¶
GetAsInt64 returns result as int64. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsList ¶
GetAsList returns result as list The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsMap ¶
GetAsMap returns result as SyncMap. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsString ¶
GetAsString returns result as string. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) GetAsTime ¶
GetAsTime returns result as Time. The ErrConvertFailed error will be returned if the assertion fails.
func (*SyncMap) ListKeyAsIntSlice ¶
ListKeyAsIntSlice returns the list of keys as an int slice.
func (*SyncMap) ListKeyAsStringSlice ¶
ListKeyAsStringSlice returns the list of keys as a string slice.