kv

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMapSlice

func GetMapSlice[K comparable, T any](m Map[K], key K) ([]T, error)

func GetMapValue

func GetMapValue[K comparable, V any](m Map[K], key K) (V, error)

func RangeMapMap

func RangeMapMap[K, K1 comparable, T any](m Map[K], key K, f func(K1, T) error) error

func RangeMapSlice

func RangeMapSlice[K comparable, T any](m Map[K], key K, f func(T) error) error

Types

type Map

type Map[K comparable] map[K]any

func MakeMap

func MakeMap[K comparable]() Map[K]

func (Map[K]) Contains

func (m Map[K]) Contains(key K) bool

func (Map[K]) Get

func (m Map[K]) Get(key K) any

func (Map[K]) GetBool

func (m Map[K]) GetBool(key K) (bool, error)

尽可能转成bool

func (Map[K]) GetComplex128

func (m Map[K]) GetComplex128(key K) (complex128, error)

尽可能转成complex

func (Map[K]) GetFloat32

func (m Map[K]) GetFloat32(key K) (float32, error)

func (Map[K]) GetFloat64

func (m Map[K]) GetFloat64(key K) (float64, error)

尽可能转成float

func (Map[K]) GetInt

func (m Map[K]) GetInt(key K) (int, error)

func (Map[K]) GetInt64

func (m Map[K]) GetInt64(key K) (int64, error)

尽可能转成int

func (Map[K]) GetMap

func (m Map[K]) GetMap(key K) (Map[K], error)

获取子map

func (Map[K]) GetMapSlice

func (m Map[K]) GetMapSlice(key K) ([]Map[K], error)

func (Map[K]) GetString

func (m Map[K]) GetString(key K) (string, error)

尽可能转成字符串

func (Map[K]) GetUint

func (m Map[K]) GetUint(key K) (uint, error)

func (Map[K]) GetUint64

func (m Map[K]) GetUint64(key K) (uint64, error)

func (Map[K]) Set

func (m Map[K]) Set(key K, val any)

type MapCache

type MapCache[K comparable] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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