multimap

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortAlpha

func SortAlpha[V any](n1, n2 *Node[V]) compare.Order

Types

type Node

type Node[V any] struct {
	Segment  string
	Value    V
	Children map[string]*Node[V]
	Sorted   []*Node[V]
}

func New

func New[V any](segment string) *Node[V]

func (*Node[V]) Create

func (n *Node[V]) Create(key string) (*Node[V], error)

Create creates an immediate child of this node.

func (*Node[V]) Get

func (n *Node[V]) Get(key string) (*Node[V], bool)

Get gets an immediate child of this node.

func (*Node[V]) GetOrCreate

func (n *Node[V]) GetOrCreate(ss []string) *Node[V]

GetOrCreate creates or returns the node at the given key.

func (*Node[V]) GetPath

func (n *Node[V]) GetPath(ss []string) (*Node[V], bool)

Get creates or returns the node at the given key.

func (*Node[V]) MustGet

func (n *Node[V]) MustGet(key string) *Node[V]

func (*Node[V]) PostOrder

func (n *Node[V]) PostOrder(f func(*Node[V]))

func (*Node[V]) Sort

func (n *Node[V]) Sort(f compare.Compare[*Node[V]])

Jump to

Keyboard shortcuts

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