path

package
v0.0.0-...-d9d3431 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapDataFullPaths

func MapDataFullPaths[A any](up *UserPath, fn func(FullPath) (A, bool, error)) ([]A, error)

Iterate over all the full paths, apply the given function to each FullPath, and return the list of results. If UserPath has an ID set, only FullPaths with matching IDs will be processed. If UserPath does not have an ID set, no filtering will be performed.

func MapFaceFullPaths

func MapFaceFullPaths[A any](up *UserPath, fn func(FullPath) (A, bool, error)) ([]A, error)

func PlainPath

func PlainPath(path string) string

TODO: Duplicate from fs module. Lazy! Bad style. Fix this when not tired.

Types

type AbsPath

type AbsPath struct {
	ID   string `json:id`
	Path string `json:path`
}

An absolute path

type FullPath

type FullPath struct {
	ID   string `json:id`
	Path string `json:path`
}

A path relative to the "sets" directory.

func NewFullPathWithID

func NewFullPathWithID(fullpath string) (*FullPath, error)

func NewFullPathWithoutID

func NewFullPathWithoutID(fullpath string) *FullPath

func (*FullPath) IsDataPath

func (path *FullPath) IsDataPath() bool

func (*FullPath) IsFacePath

func (path *FullPath) IsFacePath() bool

func (*FullPath) ToAbs

func (path *FullPath) ToAbs() *AbsPath

func (*FullPath) ToDataFullPath

func (path *FullPath) ToDataFullPath() (*FullPath, bool)

func (*FullPath) ToExistingDataFullPath

func (path *FullPath) ToExistingDataFullPath() (*FullPath, error)

func (*FullPath) ToUserPath

func (path *FullPath) ToUserPath() *UserPath

type UserPath

type UserPath struct {
	ID   string `json:id`
	Path string `json:path`
}

A path relative to the user-facing mountpoint.

func NewUserPathWithID

func NewUserPathWithID(path string) (*UserPath, error)

func NewUserPathWithoutID

func NewUserPathWithoutID(path string) UserPath

func (*UserPath) DataFullPaths

func (up *UserPath) DataFullPaths() ([]FullPath, error)

Return a list of all the full paths. Using MapFullPaths directly is more efficient, but this may be more ergonomic in some cases, and doesn't take much code to write anyway.

func (*UserPath) DataNodeSets

func (up *UserPath) DataNodeSets() ([]nodeset.NodeSet, error)

func (*UserPath) FaceFullPaths

func (up *UserPath) FaceFullPaths() ([]FullPath, error)

func (*UserPath) FaceNodeSets

func (up *UserPath) FaceNodeSets() ([]nodeset.NodeSet, error)

func (*UserPath) FirstFullPath

func (up *UserPath) FirstFullPath() (*FullPath, error)

Jump to

Keyboard shortcuts

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