gsync

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	sync.Map
	// contains filtered or unexported fields
}

Map is sync.Map with counter. It is safe for concurrent use by multiple goroutines without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.

func (*Map) Delete

func (m *Map) Delete(key interface{})

Delete deletes the value for a key.

func (*Map) Exists

func (m *Map) Exists(key interface{}) bool

Exists returns true if value is existed in the map

func (*Map) Length

func (m *Map) Length() int64

Length returns the length of the map

func (*Map) Store

func (m *Map) Store(key interface{}, value interface{})

Store sets the value for a key.

type Slice

type Slice struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Slice is safe for concurrent use by multiple goroutines without additional locking or coordination.

func (*Slice) Append

func (s *Slice) Append(value interface{})

Append append element into slice

func (*Slice) Delete

func (s *Slice) Delete(idx int)

Delete deletes element in the slice at specified index

func (*Slice) Length

func (s *Slice) Length() int

Length returns the length of the slice

func (*Slice) Range

func (s *Slice) Range(f func(index int, value interface{}) bool)

Range calls f sequentially for each value present in the slice. If f returns false, range stops the iteration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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