example

package
v0.0.0-...-7ad42f2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID string
}

type ChannelIntMap

type ChannelIntMap struct {
	sync.Mutex

	// M contains the underlying map.
	// Goroutines which access M directly should hold
	// the mutex.
	M map[Channel]int
}

ChannelIntMap is a generated thread safe map with key Channel and value int

func NewChannelIntMap

func NewChannelIntMap() *ChannelIntMap

NewChannelIntMap returns an instantiated thread safe map with key Channel and value int

func (*ChannelIntMap) Copy

func (m *ChannelIntMap) Copy() (c map[Channel]int)

Copy generates a copy of the map.

func (*ChannelIntMap) Delete

func (m *ChannelIntMap) Delete(key Channel)

Delete removes a key from the map

func (*ChannelIntMap) Exists

func (m *ChannelIntMap) Exists(key Channel) bool

Exists returns if a key exists

func (*ChannelIntMap) Get

func (m *ChannelIntMap) Get(key Channel) int

Get retrieves a key from the map

func (*ChannelIntMap) GetEx

func (m *ChannelIntMap) GetEx(key Channel) (int, bool)

GetEx retrieves a key from the map and whether it exists

func (*ChannelIntMap) Len

func (m *ChannelIntMap) Len() int

Len returns the length of the map

func (*ChannelIntMap) Open

func (m *ChannelIntMap) Open(f func())

Open allows a closure to safely operate on the map

func (*ChannelIntMap) Set

func (m *ChannelIntMap) Set(key Channel, val int)

Set sets a key on the map

func (*ChannelIntMap) SetIfNotExist

func (m *ChannelIntMap) SetIfNotExist(key Channel, val int) int

SetIfNotExist sets a key on the map if it doesn't exist. It returns the value which is set.

Jump to

Keyboard shortcuts

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