bmap

package
v0.0.0-...-e8ae10b Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bmap implements basic map with []byte key type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BMap

type BMap[T any] map[string]T

BMap implements generic hashmap with []byte key type. It is intended to store a small fixed set of keys. Added []byte keys are copied into internal byte slice for safety. Uses map with string keys internally.

func New

func New[T any](size int) BMap[T]

New create bytes map. size defines maximum number of stored keys (not counting empty key).

func (BMap[T]) Get

func (m BMap[T]) Get(key []byte) (T, bool)

Get returns stored value by key and a flag telling whether this key is stored in the map. Returns zero value if the key is not present.

func (BMap[T]) GetString

func (m BMap[T]) GetString(skey string) (T, bool)

GetString returns stored value by key and a flag telling whether this key is stored in the map. Returns zero value if the key is not present.

func (BMap[T]) Set

func (m BMap[T]) Set(key []byte, value T)

Set adds or rewrites value for given key.

func (BMap[T]) SetString

func (m BMap[T]) SetString(skey string, value T)

SetString adds or rewrites value for given key.

Jump to

Keyboard shortcuts

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