api

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMaper added in v0.0.6

type CMaper[K comparable, V any] interface {
	Delete(key K)
	Load(key K) (value V, ok bool)
	LoadAndDelete(key K) (value V, loaded bool)
	LoadOrStore(key K, value V) (actual V, loaded bool)
	Range(f func(key K, value V) bool)
	Store(key K, value V)
}

type Map

type Map[K constraints.Ordered, V any] interface {
	// 获取
	Get(k K) (elem V)
	// 获取
	GetWithBool(k K) (elem V, ok bool)
	// 删除
	Delete(k K)
	// 设置
	Set(k K, v V)
	// 设置值
	SetWithPrev(k K, v V) (prev V, replaced bool)
	// int
	Len() int
	// 遍历
	Range(callback func(k K, v V) bool)
}

type Set

type Set[K constraints.Ordered] interface {
	Set(k K)
}

TODO

type SortedMap

type SortedMap[K constraints.Ordered, V any] interface {
	Map[K, V]
	TopMin(limit int, callback func(k K, v V) bool)
	TopMax(limit int, callback func(k K, v V) bool)
}

type Trie

type Trie[V any] interface {
	Get(k string) (v V)
	SetWithPrev(k string, v V) (prev V, replaced bool)
	HasPrefix(k string) bool
	GetWithBool(k string) (v V, found bool)
	Delete(k string)
	Len() int
}

Jump to

Keyboard shortcuts

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