tmap

package
v1.2.3-beta3 Latest Latest
Warning

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

Go to latest
Published: Jul 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[T TI] map[string]T

func NewTMap

func NewTMap[T TI]() TMap[T]

func Set

func Set[T TI](key string, value T) TMap[T]

func ToTMap

func ToTMap[T TI](v any) TMap[T]

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

func (TMap[T]) Del

func (v TMap[T]) Del(key string) TMap[T]

Del deletes the values associated with key.

func (TMap[T]) Get

func (v TMap[T]) Get(key string) T

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[T]) Marshal

func (v TMap[T]) Marshal(value T) error

Marshal TMap to v

func (TMap[T]) Pop

func (v TMap[T]) Pop(key string) T

Pop return Get value and Del key

func (TMap[T]) Set

func (v TMap[T]) Set(key string, value T) TMap[T]

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