tsmap

package
v1.70.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package tsmap provides a collection of thread-safe map functions that can be safely used between multiple goroutines.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[K comparable, V any](mux threadsafe.RLocker, m map[K]V, key K) V

Get is a thread-safe function to get a value by key in a map.

Example
Output:

Hello
World

func Len

func Len[K comparable, V any](mux threadsafe.RLocker, m map[K]V) int

Len is a thread-safe function to get the length of a map.

Example
Output:

2

func Set

func Set[K comparable, V any](mux threadsafe.Locker, m map[K]V, key K, value V)

Set is a thread-safe function to assign a value to a key in a map.

Example
Output:

map[0:Hello 1:World]

Types

This section is empty.

Jump to

Keyboard shortcuts

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