mapz

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopEncode

func PopEncode(str string) string

PopEncode encodes the string for pop

Types

type Bits

type Bits struct {
	// contains filtered or unexported fields
}

Bits is a set of bits.

func NewBits

func NewBits() *Bits

NewBits returns a new Bits.

func (*Bits) Add

func (b *Bits) Add(num uint)

Add adds a number to the set.

func (*Bits) Contains

func (b *Bits) Contains(num uint) bool

Contains returns true if the set contains the number.

func (*Bits) Len

func (b *Bits) Len() int

Len returns the length of the set.

func (*Bits) Remove

func (b *Bits) Remove(num uint)

Remove removes a number from the set.

func (*Bits) String

func (b *Bits) String() string

String returns a string representation of the set.

type Body

type Body map[string]any

Body is a map[string]any

func (Body) CleanPayload

func (b Body) CleanPayload()

CleanPayload cleans the payload

func (Body) QueryBytes

func (b Body) QueryBytes(valueEncode func(string) string) []byte

QueryBytes returns the query bytes

func (Body) QueryString

func (b Body) QueryString(valueEncode func(string) string) string

QueryString returns the query string

func (Body) Read

func (b Body) Read(p []byte) (n int, err error)

Read reads the body as bytes.Reader

type SafeKV

type SafeKV[K comparable, V any] struct {
	// contains filtered or unexported fields
}

SafeKV is a thread-safe map

func NewSafeKV

func NewSafeKV[K comparable, V any](cap int) *SafeKV[K, V]

NewSafeKV creates a new SafeKV

func (*SafeKV[K, V]) Clear

func (s *SafeKV[K, V]) Clear()

Clear clears the map

func (*SafeKV[K, V]) Delete

func (s *SafeKV[K, V]) Delete(key K)

Delete deletes the value associated with the key

func (*SafeKV[K, V]) Get

func (s *SafeKV[K, V]) Get(key K) (V, bool)

Get returns the value associated with the key and whether the key existed

func (*SafeKV[K, V]) Len

func (s *SafeKV[K, V]) Len() int

Len returns the length of the map

func (*SafeKV[K, V]) Map

func (s *SafeKV[K, V]) Map(f func(map[K]V))

Map calls f with the map

func (*SafeKV[K, V]) Range

func (s *SafeKV[K, V]) Range(f func(key K, value V) bool)

Range calls f sequentially for each key and value present in the map.

func (*SafeKV[K, V]) Set

func (s *SafeKV[K, V]) Set(key K, value V)

Set sets the value associated with the key

func (*SafeKV[K, V]) SetNx

func (s *SafeKV[K, V]) SetNx(key K, value V) bool

SetNx sets the value associated with the key if the key does not exist

func (*SafeKV[K, V]) SetX

func (s *SafeKV[K, V]) SetX(key K, value V) bool

SetX sets the value associated with the key if the key exists

Jump to

Keyboard shortcuts

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