dict

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dict

type Dict[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any]() *Dict[T]

New 新建字典树 注意: key不能重复

func (*Dict[T]) Delete

func (c *Dict[T]) Delete(key string)

Delete 删除元素

func (*Dict[T]) Get added in v1.0.2

func (c *Dict[T]) Get(key string) (value T, exist bool)

Get 根据key查询数据

func (*Dict[T]) Len

func (c *Dict[T]) Len() int

func (*Dict[T]) Match

func (c *Dict[T]) Match(prefix string, f func(key string, value T) bool)

Match 前缀匹配

func (*Dict[T]) Range added in v1.1.0

func (c *Dict[T]) Range(f func(key string, value T) bool)

Range 遍历字典树

func (*Dict[T]) Reset added in v1.1.0

func (c *Dict[T]) Reset()

func (*Dict[T]) Set

func (c *Dict[T]) Set(key string, val T)

Set 插入或替换元素

func (*Dict[T]) WithIndexes added in v1.1.0

func (c *Dict[T]) WithIndexes(indexes []uint8) *Dict[T]

WithIndexes 设置索引 索引长度至少为2; 如果每个数字都满足y=pow(2,x), 索引效率更高.

Jump to

Keyboard shortcuts

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