Documentation ¶
Overview ¶
Package paths hosts the interface used by pina-golada to parse and concat relative and absolute file paths. It wraps around the raw path string to provide easy management of complex paths.
Index ¶
- func GetPathSeparator() string
- type MemoryPath
- func (m *MemoryPath) Clone() Path
- func (m *MemoryPath) Concat(other Path) Path
- func (m *MemoryPath) Direct() bool
- func (m *MemoryPath) Drop() Path
- func (m *MemoryPath) ElementAt(index int) Path
- func (m *MemoryPath) Equals(path Path) bool
- func (m *MemoryPath) Pop() Path
- func (m *MemoryPath) Size() int
- func (m *MemoryPath) Slice() []string
- func (m *MemoryPath) String() string
- func (m *MemoryPath) Valid() bool
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPathSeparator ¶
func GetPathSeparator() string
GetPathSeparator returns the paths separator of the current os
Types ¶
type MemoryPath ¶
type MemoryPath struct {
// contains filtered or unexported fields
}
MemoryPath implements the Path interface
func (*MemoryPath) Clone ¶
func (m *MemoryPath) Clone() Path
Clone will create new instance of the paths
func (*MemoryPath) Concat ¶
func (m *MemoryPath) Concat(other Path) Path
Concat will concat the two paths together
func (*MemoryPath) Direct ¶
func (m *MemoryPath) Direct() bool
Direct returns if the paths only has one element left
func (*MemoryPath) Drop ¶
func (m *MemoryPath) Drop() Path
Drop will drop the last element in the path
func (*MemoryPath) ElementAt ¶
func (m *MemoryPath) ElementAt(index int) Path
ElementAt returns the element of the paths at the given index starting at 0 If index is out of range, return an empty string
func (*MemoryPath) Equals ¶
func (m *MemoryPath) Equals(path Path) bool
Equals returns if the path is equal to another
func (*MemoryPath) Pop ¶
func (m *MemoryPath) Pop() Path
Pop will pop the first element in the paths
func (*MemoryPath) Slice ¶
func (m *MemoryPath) Slice() []string
Slice returns the slice of path entries
func (*MemoryPath) Valid ¶
func (m *MemoryPath) Valid() bool
Valid returns if the path is actually valid
type Path ¶
type Path interface { ElementAt(index int) Path Direct() bool Valid() bool Size() int Clone() Path Equals(path Path) bool Concat(other Path) Path Slice() []string String() string Pop() Path Drop() Path }
Path represents a relative paths to a file
ElementAt returns the element of the paths at the given index starting at 0 If index is out of range, the returned path is not valid
Direct returns if the paths only has one element left ¶
Valid returns if the path is actually valid ¶
Size returns the amount of elements left in the paths ¶
Clone will create new instance of the paths ¶
Concat will concat the two paths together ¶
Slice returns the slice of path entries ¶
Pop will pop the first element in the paths ¶
Drop drops the last element in the path