tmap

package
v1.2.4-beta1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 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 TI

type TI interface {
	any
}

type TMap

type TMap[K comparable, V TI] map[K]V

func NewTMap

func NewTMap[K comparable, V TI]() TMap[K, V]

func Set

func Set[K comparable, V TI](key K, value V) TMap[K, V]

func ToTMap

func ToTMap[K comparable, V TI](v any) TMap[K, V]

ToTMap struct/slice... to TMap v must be allowed

func (TMap[K, V]) Del

func (v TMap[K, V]) Del(key K) TMap[K, V]

Del deletes the values associated with key.

func (TMap[K, V]) Get

func (v TMap[K, V]) Get(key K) V

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the map directly.

func (TMap[K, V]) Marshal

func (v TMap[K, V]) Marshal(value V) error

Marshal TMap to v

func (TMap[K, V]) Pop

func (v TMap[K, V]) Pop(key K) V

Pop return Get value and Del key

func (TMap[K, V]) Set

func (v TMap[K, V]) Set(key K, value V) TMap[K, V]

Set sets the key to value. It replaces any existing values.

Jump to

Keyboard shortcuts

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