Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Child ¶
type Child interface { //Get the current child's index. Index() Index //Return the current child as a node, nil if the current child is not a node. Node() Node //Return the current child as data, nil if the current child is not data. Data() Data }
Child is a node's child.
type Data ¶
type Data interface { io.ReaderFrom io.WriterTo http.Handler //Return the path to this data. Path() Path //Stat returns info about the data. Stat() (os.FileInfo, error) //Deletes the data. Delete() error }
Data is the lowlevel interface required for Files.
type Directory ¶
type Directory struct {
Node
}
Directory can contain files or other directories.
func (Directory) File ¶
File returns the file inside the given directory with the given name.
type File ¶
type File struct {
Data
}
File contains Data
func (File) SetString ¶
SetString sets the contents of the file to the given string.
type Index ¶
Index is an index into a list returned by Node.List
type Node ¶
type Node interface { //Create this node and all parent nodes required for this node to exist. Create() error //Delete this node and all children nodes and data. Delete() error //Return the node at the relative path. Goto(relative Path) Node //Return the data of this node at the relative path. Data(name string) Data //Return the path of this node. Path() Path //Stat returns info about the directory. Stat() (os.FileInfo, error) //Slice returns a slice of children. Slice(offset Index, length int) ([]Child, error) }
Node is the lowlevel interface required for Directories. A node is a location within a tree, it doesn't have to exist.
type Path ¶
type Path string
Path is a file-system path.
func (Path) Base ¶
Base returns the last element of path. Trailing slashes are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of slashes, Base returns "/".
func (Path) Dir ¶
Dir returns all but the last element of path, typically the path's directory. After dropping the final element using Split, the path is Cleaned and trailing slashes are removed. If the path is empty, Dir returns ".". If the path consists entirely of slashes followed by non-slash bytes, Dir returns a single slash. In any other case, the returned path does not end in a slash.
func (Path) Join ¶
Join joins any number of path elements into a single path, separating them with slashes. Empty elements are ignored. The result is Cleaned. However, if the argument list is empty or all its elements are empty, Join returns an empty string.