pathutil

package
v0.0.0-...-88ab25c Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllAncestorsAndSelf

func AllAncestorsAndSelf(targetPath typedpath.SlashPath) []typedpath.SlashPath

func SplitPathElements

func SplitPathElements(targetPath typedpath.SlashPath) []typedpath.BaseName

Types

type KeyValuePair

type KeyValuePair[T interface{}] struct {
	BaseName typedpath.BaseName
	Entry    *PathTreeEntry[T]
}

type PathPair

type PathPair[T interface{}] struct {
	Path  typedpath.SlashPath
	Value T
}

type PathSet

type PathSet struct {
	// contains filtered or unexported fields
}

func NewPathSet

func NewPathSet(ignoreCase bool, ss ...typedpath.SlashPath) *PathSet

func NewPathSetWithSize

func NewPathSetWithSize(ignoreCase bool, size int) *PathSet

func (*PathSet) Add

func (s *PathSet) Add(path typedpath.SlashPath)

func (*PathSet) Difference

func (s *PathSet) Difference(other *PathSet) []typedpath.SlashPath

func (*PathSet) Has

func (s *PathSet) Has(path typedpath.SlashPath) bool

func (*PathSet) Len

func (s *PathSet) Len() int

type PathTree

type PathTree[T interface{}] map[typedpath.BaseName]*PathTreeEntry[T]

func NewPathTree

func NewPathTree(paths ...typedpath.SlashPath) PathTree[struct{}]

func NewPathTreeWithValues

func NewPathTreeWithValues[T interface{}](pairs ...PathPair[T]) PathTree[T]

func (PathTree[T]) Member

func (t PathTree[T]) Member(pathElements []typedpath.BaseName) bool

Member returns whether the pathElements is a member of the tree. Notably, returns false if the pathElements point at the tree.

func (PathTree[T]) Postorder

func (t PathTree[T]) Postorder(f func(typedpath.SlashPath, PathTreeEntry[T]) error) error

type PathTreeEntry

type PathTreeEntry[T interface{}] struct {
	Value   *T
	Subtree PathTree[T]
}

Jump to

Keyboard shortcuts

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