cmap

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 8 Imported by: 0

README

cmap: concurrent map, 并发安全 map.

本仓库是重构了concurrent-map; 由于原仓库已经很久没有维护了,所以重构了一遍,并添加了一些新的功能。 仓库会由大家共建维护,欢迎大家提交 PR。

主要修改点:
  1. 支持增加默认分片数量,由原来的固定 32 个分片,改为可配置,不设置默认也为 32 个分片。
  2. 支持整形(int32/int64)作为 key。去掉默认 string 类型 New() 默认函数。
  3. 通过接口的方式对外提供功能。
  4. 使用 mockery 工具对泛型接口进行 mock。
  5. 添加了 examples 文件夹,提供了一些使用示例。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIterCb

func DefaultIterCb[K Stringer, V any](key K, v V)

DefaultIterCb is the default iterator callback function.

func DefaultRemoveCb

func DefaultRemoveCb[K Stringer, V any](key K, v V, exists bool) bool

DefaultRemoveCb is the default remove callback function.

func DefaultUpsertCb

func DefaultUpsertCb[K Stringer, V any](exist bool, valueInMap V, newValue V) V

DefaultUpsertCb is the default upsert callback function.

Types

type ConcurrentMapInterface

type ConcurrentMapInterface[K Stringer, V any] interface {
	Count() int
	GetSlotNum() int
	IsEmpty() bool
	GetSlot(key K) *ConcurrentMapSlotted[K, V]
	Set(key K, value V)
	SetIfAbsent(key K, value V) bool
	MSet(data map[K]V)
	Upsert(key K, value V, cb UpsertCb[K, V]) V
	Get(key K) (V, bool)
	Pop(key K) (v V, ok bool)
	Has(key K) bool
	Remove(key K)
	RemoveCb(key K, cb RemoveCb[K, V]) bool
	Iter() <-chan Tuple[K, V]
	IterCb(key K, v V, cb IterCb[K, V])
	Items() map[K]V
	Keys() []K
	Tuples() []Tuple[K, V]
	Clear()
	UnmarshalJSON(b []byte) error
	MarshalJSON() ([]byte, error)
}

ConcurrentMapInterface is the interface of ConcurrentMap

func New

func New[K Stringer, V any](opts ...ConcurrentMapOption[K, V]) ConcurrentMapInterface[K, V]

New create a new ConcurrentMap

type ConcurrentMapOption

type ConcurrentMapOption[K Stringer, V any] func(*concurrentMap[K, V])

func WithConcurrentMapSlotNum

func WithConcurrentMapSlotNum[K Stringer, V any](slotNum int) ConcurrentMapOption[K, V]

WithConcurrentMapSlotNum is a concurrent map option that sets the slot number.

func WithConcurrentMapSloting

func WithConcurrentMapSloting[K Stringer, V any](sloting func(key K) uint32) ConcurrentMapOption[K, V]

WithConcurrentMapSloting is a concurrent map option that sets the sloting function.

type ConcurrentMapSlotted

type ConcurrentMapSlotted[K Stringer, V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ConcurrentMapSlotted The key/value pairs stored in the slots of a concurrent map

type Integer

type Integer int

func (Integer) String

func (i Integer) String() string

type Integer32

type Integer32 int32

func (Integer32) String

func (i Integer32) String() string

type IterCb

type IterCb[K Stringer, V any] func(key K, v V)

type MockConcurrentMapInterface

type MockConcurrentMapInterface[K Stringer, V any] struct {
	mock.Mock
}

MockConcurrentMapInterface is an autogenerated mock type for the ConcurrentMapInterface type

func NewMockConcurrentMapInterface

func NewMockConcurrentMapInterface[K Stringer, V any](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockConcurrentMapInterface[K, V]

NewMockConcurrentMapInterface creates a new instance of MockConcurrentMapInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockConcurrentMapInterface[K, V]) Clear

func (_mock *MockConcurrentMapInterface[K, V]) Clear()

Clear provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Count

func (_mock *MockConcurrentMapInterface[K, V]) Count() int

Count provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) EXPECT

func (*MockConcurrentMapInterface[K, V]) Get

func (_mock *MockConcurrentMapInterface[K, V]) Get(key K) (V, bool)

Get provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) GetSlot

func (_mock *MockConcurrentMapInterface[K, V]) GetSlot(key K) *ConcurrentMapSlotted[K, V]

GetSlot provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) GetSlotNum

func (_mock *MockConcurrentMapInterface[K, V]) GetSlotNum() int

GetSlotNum provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) GetSlotkeyNum

func (_mock *MockConcurrentMapInterface[K, V]) GetSlotkeyNum(idx int) int

GetSlotkeyNum provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) GetSlots

func (_mock *MockConcurrentMapInterface[K, V]) GetSlots(idx int) *ConcurrentMapSlotted[K, V]

GetSlots provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Has

func (_mock *MockConcurrentMapInterface[K, V]) Has(key K) bool

Has provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) IsEmpty

func (_mock *MockConcurrentMapInterface[K, V]) IsEmpty() bool

IsEmpty provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Items

func (_mock *MockConcurrentMapInterface[K, V]) Items() map[K]V

Items provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Iter

func (_mock *MockConcurrentMapInterface[K, V]) Iter() <-chan Tuple[K, V]

Iter provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) IterCb

func (_mock *MockConcurrentMapInterface[K, V]) IterCb(key K, v V, cb IterCb[K, V])

IterCb provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Keys

func (_mock *MockConcurrentMapInterface[K, V]) Keys() []K

Keys provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) ListSlots

func (_mock *MockConcurrentMapInterface[K, V]) ListSlots() []*ConcurrentMapSlotted[K, V]

ListSlots provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) MSet

func (_mock *MockConcurrentMapInterface[K, V]) MSet(data map[K]V)

MSet provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) MarshalJSON

func (_mock *MockConcurrentMapInterface[K, V]) MarshalJSON() ([]byte, error)

MarshalJSON provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Pop

func (_mock *MockConcurrentMapInterface[K, V]) Pop(key K) (V, bool)

Pop provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Remove

func (_mock *MockConcurrentMapInterface[K, V]) Remove(key K)

Remove provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) RemoveCb

func (_mock *MockConcurrentMapInterface[K, V]) RemoveCb(key K, cb RemoveCb[K, V]) bool

RemoveCb provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Set

func (_mock *MockConcurrentMapInterface[K, V]) Set(key K, value V)

Set provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) SetIfAbsent

func (_mock *MockConcurrentMapInterface[K, V]) SetIfAbsent(key K, value V) bool

SetIfAbsent provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Tuples

func (_mock *MockConcurrentMapInterface[K, V]) Tuples() []Tuple[K, V]

Tuples provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) UnmarshalJSON

func (_mock *MockConcurrentMapInterface[K, V]) UnmarshalJSON(b []byte) error

UnmarshalJSON provides a mock function for the type MockConcurrentMapInterface

func (*MockConcurrentMapInterface[K, V]) Upsert

func (_mock *MockConcurrentMapInterface[K, V]) Upsert(key K, value V, cb UpsertCb[K, V]) V

Upsert provides a mock function for the type MockConcurrentMapInterface

type MockConcurrentMapInterface_Clear_Call

type MockConcurrentMapInterface_Clear_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear'

func (*MockConcurrentMapInterface_Clear_Call[K, V]) Return

func (*MockConcurrentMapInterface_Clear_Call[K, V]) Run

func (*MockConcurrentMapInterface_Clear_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Clear_Call[K, V]) RunAndReturn(run func()) *MockConcurrentMapInterface_Clear_Call[K, V]

type MockConcurrentMapInterface_Count_Call

type MockConcurrentMapInterface_Count_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count'

func (*MockConcurrentMapInterface_Count_Call[K, V]) Return

func (*MockConcurrentMapInterface_Count_Call[K, V]) Run

func (*MockConcurrentMapInterface_Count_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Count_Call[K, V]) RunAndReturn(run func() int) *MockConcurrentMapInterface_Count_Call[K, V]

type MockConcurrentMapInterface_Expecter

type MockConcurrentMapInterface_Expecter[K Stringer, V any] struct {
	// contains filtered or unexported fields
}

func (*MockConcurrentMapInterface_Expecter[K, V]) Clear

Clear is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) Count

Count is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) Get

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Get(key interface{}) *MockConcurrentMapInterface_Get_Call[K, V]

Get is a helper method to define mock.On call

  • key K

func (*MockConcurrentMapInterface_Expecter[K, V]) GetSlot

func (_e *MockConcurrentMapInterface_Expecter[K, V]) GetSlot(key interface{}) *MockConcurrentMapInterface_GetSlot_Call[K, V]

GetSlot is a helper method to define mock.On call

  • key K

func (*MockConcurrentMapInterface_Expecter[K, V]) GetSlotNum

GetSlotNum is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) GetSlotkeyNum

func (_e *MockConcurrentMapInterface_Expecter[K, V]) GetSlotkeyNum(idx interface{}) *MockConcurrentMapInterface_GetSlotkeyNum_Call[K, V]

GetSlotkeyNum is a helper method to define mock.On call

  • idx int

func (*MockConcurrentMapInterface_Expecter[K, V]) GetSlots

func (_e *MockConcurrentMapInterface_Expecter[K, V]) GetSlots(idx interface{}) *MockConcurrentMapInterface_GetSlots_Call[K, V]

GetSlots is a helper method to define mock.On call

  • idx int

func (*MockConcurrentMapInterface_Expecter[K, V]) Has

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Has(key interface{}) *MockConcurrentMapInterface_Has_Call[K, V]

Has is a helper method to define mock.On call

  • key K

func (*MockConcurrentMapInterface_Expecter[K, V]) IsEmpty

IsEmpty is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) Items

Items is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) Iter

Iter is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) IterCb

func (_e *MockConcurrentMapInterface_Expecter[K, V]) IterCb(key interface{}, v interface{}, cb interface{}) *MockConcurrentMapInterface_IterCb_Call[K, V]

IterCb is a helper method to define mock.On call

  • key K
  • v V
  • cb IterCb[K, V]

func (*MockConcurrentMapInterface_Expecter[K, V]) Keys

Keys is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) ListSlots

ListSlots is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) MSet

func (_e *MockConcurrentMapInterface_Expecter[K, V]) MSet(data interface{}) *MockConcurrentMapInterface_MSet_Call[K, V]

MSet is a helper method to define mock.On call

  • data map[K]V

func (*MockConcurrentMapInterface_Expecter[K, V]) MarshalJSON

MarshalJSON is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) Pop

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Pop(key interface{}) *MockConcurrentMapInterface_Pop_Call[K, V]

Pop is a helper method to define mock.On call

  • key K

func (*MockConcurrentMapInterface_Expecter[K, V]) Remove

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Remove(key interface{}) *MockConcurrentMapInterface_Remove_Call[K, V]

Remove is a helper method to define mock.On call

  • key K

func (*MockConcurrentMapInterface_Expecter[K, V]) RemoveCb

func (_e *MockConcurrentMapInterface_Expecter[K, V]) RemoveCb(key interface{}, cb interface{}) *MockConcurrentMapInterface_RemoveCb_Call[K, V]

RemoveCb is a helper method to define mock.On call

  • key K
  • cb RemoveCb[K, V]

func (*MockConcurrentMapInterface_Expecter[K, V]) Set

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Set(key interface{}, value interface{}) *MockConcurrentMapInterface_Set_Call[K, V]

Set is a helper method to define mock.On call

  • key K
  • value V

func (*MockConcurrentMapInterface_Expecter[K, V]) SetIfAbsent

func (_e *MockConcurrentMapInterface_Expecter[K, V]) SetIfAbsent(key interface{}, value interface{}) *MockConcurrentMapInterface_SetIfAbsent_Call[K, V]

SetIfAbsent is a helper method to define mock.On call

  • key K
  • value V

func (*MockConcurrentMapInterface_Expecter[K, V]) Tuples

Tuples is a helper method to define mock.On call

func (*MockConcurrentMapInterface_Expecter[K, V]) UnmarshalJSON

func (_e *MockConcurrentMapInterface_Expecter[K, V]) UnmarshalJSON(b interface{}) *MockConcurrentMapInterface_UnmarshalJSON_Call[K, V]

UnmarshalJSON is a helper method to define mock.On call

  • b []byte

func (*MockConcurrentMapInterface_Expecter[K, V]) Upsert

func (_e *MockConcurrentMapInterface_Expecter[K, V]) Upsert(key interface{}, value interface{}, cb interface{}) *MockConcurrentMapInterface_Upsert_Call[K, V]

Upsert is a helper method to define mock.On call

  • key K
  • value V
  • cb UpsertCb[K, V]

type MockConcurrentMapInterface_GetSlotNum_Call

type MockConcurrentMapInterface_GetSlotNum_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_GetSlotNum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotNum'

func (*MockConcurrentMapInterface_GetSlotNum_Call[K, V]) Return

func (*MockConcurrentMapInterface_GetSlotNum_Call[K, V]) Run

func (*MockConcurrentMapInterface_GetSlotNum_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_GetSlot_Call

type MockConcurrentMapInterface_GetSlot_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_GetSlot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlot'

func (*MockConcurrentMapInterface_GetSlot_Call[K, V]) Return

func (*MockConcurrentMapInterface_GetSlot_Call[K, V]) Run

func (*MockConcurrentMapInterface_GetSlot_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_GetSlotkeyNum_Call

type MockConcurrentMapInterface_GetSlotkeyNum_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_GetSlotkeyNum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotkeyNum'

func (*MockConcurrentMapInterface_GetSlotkeyNum_Call[K, V]) Return

func (*MockConcurrentMapInterface_GetSlotkeyNum_Call[K, V]) Run

func (*MockConcurrentMapInterface_GetSlotkeyNum_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_GetSlots_Call

type MockConcurrentMapInterface_GetSlots_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_GetSlots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlots'

func (*MockConcurrentMapInterface_GetSlots_Call[K, V]) Return

func (*MockConcurrentMapInterface_GetSlots_Call[K, V]) Run

func (*MockConcurrentMapInterface_GetSlots_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_Get_Call

type MockConcurrentMapInterface_Get_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockConcurrentMapInterface_Get_Call[K, V]) Return

func (*MockConcurrentMapInterface_Get_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_Get_Call[K, V]) Run(run func(key K)) *MockConcurrentMapInterface_Get_Call[K, V]

func (*MockConcurrentMapInterface_Get_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Get_Call[K, V]) RunAndReturn(run func(key K) (V, bool)) *MockConcurrentMapInterface_Get_Call[K, V]

type MockConcurrentMapInterface_Has_Call

type MockConcurrentMapInterface_Has_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Has_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Has'

func (*MockConcurrentMapInterface_Has_Call[K, V]) Return

func (*MockConcurrentMapInterface_Has_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_Has_Call[K, V]) Run(run func(key K)) *MockConcurrentMapInterface_Has_Call[K, V]

func (*MockConcurrentMapInterface_Has_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Has_Call[K, V]) RunAndReturn(run func(key K) bool) *MockConcurrentMapInterface_Has_Call[K, V]

type MockConcurrentMapInterface_IsEmpty_Call

type MockConcurrentMapInterface_IsEmpty_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_IsEmpty_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsEmpty'

func (*MockConcurrentMapInterface_IsEmpty_Call[K, V]) Return

func (*MockConcurrentMapInterface_IsEmpty_Call[K, V]) Run

func (*MockConcurrentMapInterface_IsEmpty_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_Items_Call

type MockConcurrentMapInterface_Items_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Items_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Items'

func (*MockConcurrentMapInterface_Items_Call[K, V]) Return

func (*MockConcurrentMapInterface_Items_Call[K, V]) Run

func (*MockConcurrentMapInterface_Items_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Items_Call[K, V]) RunAndReturn(run func() map[K]V) *MockConcurrentMapInterface_Items_Call[K, V]

type MockConcurrentMapInterface_IterCb_Call

type MockConcurrentMapInterface_IterCb_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_IterCb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IterCb'

func (*MockConcurrentMapInterface_IterCb_Call[K, V]) Return

func (*MockConcurrentMapInterface_IterCb_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_IterCb_Call[K, V]) Run(run func(key K, v V, cb IterCb[K, V])) *MockConcurrentMapInterface_IterCb_Call[K, V]

func (*MockConcurrentMapInterface_IterCb_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_IterCb_Call[K, V]) RunAndReturn(run func(key K, v V, cb IterCb[K, V])) *MockConcurrentMapInterface_IterCb_Call[K, V]

type MockConcurrentMapInterface_Iter_Call

type MockConcurrentMapInterface_Iter_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Iter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Iter'

func (*MockConcurrentMapInterface_Iter_Call[K, V]) Return

func (_c *MockConcurrentMapInterface_Iter_Call[K, V]) Return(tupleCh <-chan Tuple[K, V]) *MockConcurrentMapInterface_Iter_Call[K, V]

func (*MockConcurrentMapInterface_Iter_Call[K, V]) Run

func (*MockConcurrentMapInterface_Iter_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Iter_Call[K, V]) RunAndReturn(run func() <-chan Tuple[K, V]) *MockConcurrentMapInterface_Iter_Call[K, V]

type MockConcurrentMapInterface_Keys_Call

type MockConcurrentMapInterface_Keys_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Keys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Keys'

func (*MockConcurrentMapInterface_Keys_Call[K, V]) Return

func (*MockConcurrentMapInterface_Keys_Call[K, V]) Run

func (*MockConcurrentMapInterface_Keys_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Keys_Call[K, V]) RunAndReturn(run func() []K) *MockConcurrentMapInterface_Keys_Call[K, V]

type MockConcurrentMapInterface_ListSlots_Call

type MockConcurrentMapInterface_ListSlots_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_ListSlots_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSlots'

func (*MockConcurrentMapInterface_ListSlots_Call[K, V]) Return

func (*MockConcurrentMapInterface_ListSlots_Call[K, V]) Run

func (*MockConcurrentMapInterface_ListSlots_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_MSet_Call

type MockConcurrentMapInterface_MSet_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_MSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MSet'

func (*MockConcurrentMapInterface_MSet_Call[K, V]) Return

func (*MockConcurrentMapInterface_MSet_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_MSet_Call[K, V]) Run(run func(data map[K]V)) *MockConcurrentMapInterface_MSet_Call[K, V]

func (*MockConcurrentMapInterface_MSet_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_MSet_Call[K, V]) RunAndReturn(run func(data map[K]V)) *MockConcurrentMapInterface_MSet_Call[K, V]

type MockConcurrentMapInterface_MarshalJSON_Call

type MockConcurrentMapInterface_MarshalJSON_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_MarshalJSON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarshalJSON'

func (*MockConcurrentMapInterface_MarshalJSON_Call[K, V]) Return

func (*MockConcurrentMapInterface_MarshalJSON_Call[K, V]) Run

func (*MockConcurrentMapInterface_MarshalJSON_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_Pop_Call

type MockConcurrentMapInterface_Pop_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Pop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pop'

func (*MockConcurrentMapInterface_Pop_Call[K, V]) Return

func (*MockConcurrentMapInterface_Pop_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_Pop_Call[K, V]) Run(run func(key K)) *MockConcurrentMapInterface_Pop_Call[K, V]

func (*MockConcurrentMapInterface_Pop_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Pop_Call[K, V]) RunAndReturn(run func(key K) (V, bool)) *MockConcurrentMapInterface_Pop_Call[K, V]

type MockConcurrentMapInterface_RemoveCb_Call

type MockConcurrentMapInterface_RemoveCb_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_RemoveCb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveCb'

func (*MockConcurrentMapInterface_RemoveCb_Call[K, V]) Return

func (*MockConcurrentMapInterface_RemoveCb_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_RemoveCb_Call[K, V]) Run(run func(key K, cb RemoveCb[K, V])) *MockConcurrentMapInterface_RemoveCb_Call[K, V]

func (*MockConcurrentMapInterface_RemoveCb_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_RemoveCb_Call[K, V]) RunAndReturn(run func(key K, cb RemoveCb[K, V]) bool) *MockConcurrentMapInterface_RemoveCb_Call[K, V]

type MockConcurrentMapInterface_Remove_Call

type MockConcurrentMapInterface_Remove_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'

func (*MockConcurrentMapInterface_Remove_Call[K, V]) Return

func (*MockConcurrentMapInterface_Remove_Call[K, V]) Run

func (*MockConcurrentMapInterface_Remove_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Remove_Call[K, V]) RunAndReturn(run func(key K)) *MockConcurrentMapInterface_Remove_Call[K, V]

type MockConcurrentMapInterface_SetIfAbsent_Call

type MockConcurrentMapInterface_SetIfAbsent_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_SetIfAbsent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetIfAbsent'

func (*MockConcurrentMapInterface_SetIfAbsent_Call[K, V]) Return

func (*MockConcurrentMapInterface_SetIfAbsent_Call[K, V]) Run

func (*MockConcurrentMapInterface_SetIfAbsent_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_SetIfAbsent_Call[K, V]) RunAndReturn(run func(key K, value V) bool) *MockConcurrentMapInterface_SetIfAbsent_Call[K, V]

type MockConcurrentMapInterface_Set_Call

type MockConcurrentMapInterface_Set_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'

func (*MockConcurrentMapInterface_Set_Call[K, V]) Return

func (*MockConcurrentMapInterface_Set_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_Set_Call[K, V]) Run(run func(key K, value V)) *MockConcurrentMapInterface_Set_Call[K, V]

func (*MockConcurrentMapInterface_Set_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Set_Call[K, V]) RunAndReturn(run func(key K, value V)) *MockConcurrentMapInterface_Set_Call[K, V]

type MockConcurrentMapInterface_Tuples_Call

type MockConcurrentMapInterface_Tuples_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Tuples_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tuples'

func (*MockConcurrentMapInterface_Tuples_Call[K, V]) Return

func (*MockConcurrentMapInterface_Tuples_Call[K, V]) Run

func (*MockConcurrentMapInterface_Tuples_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Tuples_Call[K, V]) RunAndReturn(run func() []Tuple[K, V]) *MockConcurrentMapInterface_Tuples_Call[K, V]

type MockConcurrentMapInterface_UnmarshalJSON_Call

type MockConcurrentMapInterface_UnmarshalJSON_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_UnmarshalJSON_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnmarshalJSON'

func (*MockConcurrentMapInterface_UnmarshalJSON_Call[K, V]) Return

func (*MockConcurrentMapInterface_UnmarshalJSON_Call[K, V]) Run

func (*MockConcurrentMapInterface_UnmarshalJSON_Call[K, V]) RunAndReturn

type MockConcurrentMapInterface_Upsert_Call

type MockConcurrentMapInterface_Upsert_Call[K Stringer, V any] struct {
	*mock.Call
}

MockConcurrentMapInterface_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert'

func (*MockConcurrentMapInterface_Upsert_Call[K, V]) Return

func (*MockConcurrentMapInterface_Upsert_Call[K, V]) Run

func (_c *MockConcurrentMapInterface_Upsert_Call[K, V]) Run(run func(key K, value V, cb UpsertCb[K, V])) *MockConcurrentMapInterface_Upsert_Call[K, V]

func (*MockConcurrentMapInterface_Upsert_Call[K, V]) RunAndReturn

func (_c *MockConcurrentMapInterface_Upsert_Call[K, V]) RunAndReturn(run func(key K, value V, cb UpsertCb[K, V]) V) *MockConcurrentMapInterface_Upsert_Call[K, V]

type MockStringer

type MockStringer struct {
	mock.Mock
}

MockStringer is an autogenerated mock type for the Stringer type

func NewMockStringer

func NewMockStringer(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockStringer

NewMockStringer creates a new instance of MockStringer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockStringer) EXPECT

func (_m *MockStringer) EXPECT() *MockStringer_Expecter

func (*MockStringer) String

func (_mock *MockStringer) String() string

String provides a mock function for the type MockStringer

type MockStringer_Expecter

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

func (*MockStringer_Expecter) String

String is a helper method to define mock.On call

type MockStringer_String_Call

type MockStringer_String_Call struct {
	*mock.Call
}

MockStringer_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String'

func (*MockStringer_String_Call) Return

func (*MockStringer_String_Call) Run

func (*MockStringer_String_Call) RunAndReturn

func (_c *MockStringer_String_Call) RunAndReturn(run func() string) *MockStringer_String_Call

type RemoveCb

type RemoveCb[K Stringer, V any] func(key K, v V, exists bool) bool

type SlotingFunc

type SlotingFunc[K Stringer] func(key K) uint32

type String

type String string

func (String) String

func (s String) String() string

type Stringer

type Stringer interface {
	fmt.Stringer
	comparable
}

Stringer is a stringer interface.

type Tuple

type Tuple[K Stringer, V any] struct {
	Key   K
	Value V
}

Tuple is a key-value pair.

type UpsertCb

type UpsertCb[K Stringer, V any] func(exist bool, valueInMap V, newValue V) V

Directories

Path Synopsis
common
examples
integermap command

Jump to

Keyboard shortcuts

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