Documentation
¶
Index ¶
- func Default[T comparable](v T, def T) T
- func Max[T constraints.Ordered](v1, v2 T) T
- func MaxSlice[T constraints.Ordered](va ...T) T
- func Min[T constraints.Ordered](v1, v2 T) T
- func MinSlice[T constraints.Ordered](va ...T) T
- type FilterFn
- type Node
- type NodeType
- type Nodes
- type SearchFn
- type SortOrder
- type StringTreeArg
- type TransformFn
- type Tree
- func (t *Tree[T]) Empty() bool
- func (t *Tree[T]) ExactMatch(values []T) (*Node[T], bool)
- func (t *Tree[T]) Insert(values []T)
- func (t *Tree[T]) Match(values []T) (*Node[T], bool)
- func (t *Tree[T]) MaxDepth() int
- func (t *Tree[T]) MinDepth() int
- func (t *Tree[T]) Name() string
- func (t *Tree[T]) PrintTo(w io.Writer)
- func (t *Tree[T]) Sort(order ...SortOrder)
- func (t *Tree[T]) SortOrder() SortOrder
- func (t *Tree[T]) Sorted() bool
- func (t *Tree[T]) Visit(values []T) *Node[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default[T comparable](v T, def T) T
Default return v or default if v has zero value
func MaxSlice ¶ added in v0.1.2
func MaxSlice[T constraints.Ordered](va ...T) T
MaxSlice return maximum values within slices
func Min ¶ added in v0.1.2
func Min[T constraints.Ordered](v1, v2 T) T
Min return minum between two values
func MinSlice ¶ added in v0.1.2
func MinSlice[T constraints.Ordered](va ...T) T
MinSlice return minimum values for given slices
Types ¶
type NodeType ¶
type NodeType interface { comparable constraints.Ordered }
NodeType constraint having comparable and Ordered constraint
type StringTreeArg ¶
type StringTreeArg struct { Sep string Name string FnFilter FilterFn[string] FnTransform TransformFn[string] }
StringTreeArg for generating tree
type Tree ¶
type Tree[T NodeType] struct { // contains filtered or unexported fields }
Tree structure
func NewStringTree ¶
func NewStringTree(r io.Reader, arg StringTreeArg) *Tree[string]
NewStringTree with given name
func (*Tree[T]) ExactMatch ¶
Match all values
func (*Tree[T]) Sort ¶
Sort nodes in ASCENDING / DESCENDING order. If parameter is not specified, nodes will be sorted in ASCENDING order.
Click to show internal directories.
Click to hide internal directories.