paths

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPathEmpty = errors.New("path is empty")
)

Functions

func Concatenate

func Concatenate(paths ...string) string

* Concatenate two paths together (takes care of leading / trailing '/') * e.g. (space1/, /space2/) -> space1/space2 * * NOTE: All leading, trailing, and consecutive '/' will be trimmed to ensure correct paths.

func DisectLeaf

func DisectLeaf(path string) (string, string, error)

DisectLeaf splits a path into its parent path and the leaf name e.g. space1/space2/space3 -> (space1/space2, space3, nil).

func DisectRoot

func DisectRoot(path string) (string, string, error)

DisectRoot splits a path into its root space and sub-path e.g. space1/space2/space3 -> (space1, space2/space3, nil).

func IsAncesterOf

func IsAncesterOf(path string, other string) bool

IsAncesterOf returns true iff 'path' is an ancestor of 'other' or they are the same. e.g. other = path(/.*).

func Parent

func Parent(path string) string

Parent returns the parent path of the provided path. if the path doesn't have a parent an empty string is returned.

func Segments

func Segments(path string) []string

Segments returns all segments of the path e.g. /space1/space2/space3 -> [space1, space2, space3].

Types

This section is empty.

Jump to

Keyboard shortcuts

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