Documentation ¶
Overview ¶
Package radixtree implements a tree lookup for values associated to paths.
This package is a fork of https://github.com/dimfeld/httptreemux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ConstraintsFunc ¶
type LookupMatcher ¶
type LookupMatcher[V any] interface { // Match should return true if the value should be returned by the lookup. Match(value V, keys, values []string) bool }
LookupMatcher is used for additional checks while performing the lookup of values in the spanned tree.
type LookupMatcherFunc ¶
The LookupMatcherFunc type is an adapter to allow the use of ordinary functions as match functions. If f is a function with the appropriate signature, LookupMatcherFunc(f) is a LookupMatcher that calls f.
func (LookupMatcherFunc[V]) Match ¶
func (f LookupMatcherFunc[V]) Match(value V, keys, values []string) bool
Match calls f(value).
type Option ¶
type Option[V any] func(n *Tree[V])
func WithValuesConstraints ¶
func WithValuesConstraints[V any](constraints ConstraintsFunc[V]) Option[V]
type Tree ¶
type Tree[V any] struct { // contains filtered or unexported fields }
func (*Tree[V]) Delete ¶
func (n *Tree[V]) Delete(path string, matcher ValueMatcher[V]) error
func (*Tree[V]) Find ¶
func (n *Tree[V]) Find(path string, matcher LookupMatcher[V]) (*Entry[V], error)
type ValueMatcher ¶
type ValueMatcher[V any] interface { // Match should return true if the value should be deleted from the tree. Match(value V) bool }
ValueMatcher is used for additional checks while deleting of values in the spanned tree.
type ValueMatcherFunc ¶
The ValueMatcherFunc type is an adapter to allow the use of ordinary functions as match functions. If f is a function with the appropriate signature, ValueMatcherFunc(f) is a ValueMatcher that calls f.
func (ValueMatcherFunc[V]) Match ¶
func (f ValueMatcherFunc[V]) Match(value V) bool
Match calls f(value).