Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultPathSplitFunc(s string) ([]string, error)
- type PathSplitFunc
- type SyncTrie
- func (x *SyncTrie[T]) Add(path string, value T) error
- func (x *SyncTrie[T]) Contains(path string) (bool, error)
- func (x *SyncTrie[T]) ExportToDotLanguage() string
- func (x *SyncTrie[T]) FindTrieNode(path string) ([]string, *TrieNode[T], error)
- func (x *SyncTrie[T]) Query(path string) (value T, err error)
- func (x *SyncTrie[T]) QueryByPrefix(prefix string, delimiter ...string) []*tuple.Tuple2[string, T]
- func (x *SyncTrie[T]) QueryOrDefault(path string, defaultValue T) (value T, err error)
- func (x *SyncTrie[T]) Remove(path string) error
- func (x *SyncTrie[T]) ToSlice(delimiter ...string) []*tuple.Tuple2[string, T]
- func (x *SyncTrie[T]) Upsert(path string, value T) error
- type Trie
- func (x *Trie[T]) Add(path string, value T) error
- func (x *Trie[T]) Contains(path string) (bool, error)
- func (x *Trie[T]) ExportToDotLanguage() string
- func (x *Trie[T]) FindTrieNode(path string) ([]string, *TrieNode[T], error)
- func (x *Trie[T]) Query(path string) (value T, err error)
- func (x *Trie[T]) QueryByPrefix(prefix string, delimiter ...string) []*tuple.Tuple2[string, T]
- func (x *Trie[T]) QueryOrDefault(path string, defaultValue T) (value T, err error)
- func (x *Trie[T]) Remove(path string) error
- func (x *Trie[T]) RootTrieNode() *TrieNode[T]
- func (x *Trie[T]) ToSlice(delimiter ...string) []*tuple.Tuple2[string, T]
- func (x *Trie[T]) Upsert(path string, value T) error
- type TrieNode
Constants ¶
View Source
const DefaultDelimiter = ""
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func DefaultPathSplitFunc ¶
Types ¶
type PathSplitFunc ¶
PathSplitFunc 用于把传入的路径字符串切割为字典中的一个项,默认是按照字符来切割,使用者可根据自己的需求自定义切割方式
type SyncTrie ¶
type SyncTrie[T any] struct { // contains filtered or unexported fields }
func NewSync ¶
func NewSync[T any](pathSplitFunc ...PathSplitFunc) *SyncTrie[T]
func (*SyncTrie[T]) ExportToDotLanguage ¶
func (*SyncTrie[T]) FindTrieNode ¶
FindTrieNode 寻找路径绑定的节点
func (*SyncTrie[T]) QueryByPrefix ¶
QueryByPrefix 根据前缀查询
func (*SyncTrie[T]) QueryOrDefault ¶
QueryOrDefault 查询给定的路径的负载,如果不存在的话则返回默认值
type Trie ¶
type Trie[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any](pathSplitFunc ...PathSplitFunc) *Trie[T]
func (*Trie[T]) ExportToDotLanguage ¶
func (*Trie[T]) FindTrieNode ¶
FindTrieNode 寻找路径绑定的节点
func (*Trie[T]) QueryByPrefix ¶
QueryByPrefix 根据前缀查询
func (*Trie[T]) QueryOrDefault ¶
QueryOrDefault 查询给定的路径的负载,如果不存在的话则返回默认值
Click to show internal directories.
Click to hide internal directories.