Documentation
¶
Index ¶
- Variables
- func FileTreeToMap(tree FileTree, base string) (map[string]File, error)
- func FileTreeWalk(tree FileTree, treeFunc func(tree FileTree) (FileTree, error)) error
- type File
- type FileComparator
- type FileMap
- type FileSystem
- type FileTree
- type MockFile
- type MockFileSystem
- func (fs MockFileSystem) Delete(string) error
- func (fs MockFileSystem) Dir(string) ([]File, error)
- func (fs MockFileSystem) FileMap(root File) FileMap
- func (fs MockFileSystem) FileTree(root File) *FileTree
- func (fs MockFileSystem) MkDir(file File) error
- func (fs MockFileSystem) Read(File) ([]byte, error)
- func (fs MockFileSystem) ReadFile(file string) (File, error)
- func (fs MockFileSystem) Write(File, []byte, os.FileMode) error
- type MockFileTree
Constants ¶
This section is empty.
Variables ¶
View Source
var ModifiedComparator = func(src File, dest File) bool { if src.ModTime().After(dest.ModTime()) { return false } return true }
Compares the last modified time of the File
Functions ¶
func FileTreeToMap ¶
Convert a FileTree to an Ordered ListMap
Types ¶
type File ¶
type File struct { FileName string // base name of the file FilePath string // Full path to file, including filename FileSize int64 // length in bytes for regular files; system-dependent for others FileModTime time.Time // modification time FileMode os.FileMode // File details including perms }
Simple File abstraction (based on os.FileInfo)
All local and remote files will be represented as a File. It is up to the specific FileSystem implementation to uphold this
func FileMapDiff ¶
type FileComparator ¶
A function that returns true iff the src and dest files are the same based on their definition
type FileSystem ¶
type FileSystem interface { Dir(string) ([]File, error) // Read the contents of a directory Read(File) ([]byte, error) // Read a File ReadFile(file string) (File, error) // Read a file and return a File Write(file File, data []byte, perm os.FileMode) error // Write a File FileTree(root File) *FileTree // Returns a FileTree structure of Files representing the FileSystem hierarchy FileMap(root File) FileMap // Returns a FileMap structure of Files representing a flattened FileSystem hierarchy MkDir(file File) error Delete(file string) error // Delete a file on the FileSystem }
Generic File System abstraction
type MockFile ¶
type MockFile struct { MockName string // base name of the file MockPath string // base name of the file MockSize int64 // length in bytes for regular files; system-dependent for others MockModTime time.Time // modification time MockIsDir bool // abbreviation for Mode().IsDir() MockFileMode os.FileMode MockFileSys interface{} }
type MockFileSystem ¶
type MockFileSystem struct { ReadBytes []byte ReadError error WriteError error DirFiles []File DirError error FileTreeTree *FileTree FileMapMap FileMap MockFile File MockFileError error }
func (MockFileSystem) Delete ¶
func (fs MockFileSystem) Delete(string) error
func (MockFileSystem) FileMap ¶
func (fs MockFileSystem) FileMap(root File) FileMap
func (MockFileSystem) FileTree ¶
func (fs MockFileSystem) FileTree(root File) *FileTree
func (MockFileSystem) MkDir ¶
func (fs MockFileSystem) MkDir(file File) error
type MockFileTree ¶
func (*MockFileTree) ChildNodes ¶
func (t *MockFileTree) ChildNodes() []*FileTree
func (*MockFileTree) File ¶
func (t *MockFileTree) File() File
func (*MockFileTree) ParentNode ¶
func (t *MockFileTree) ParentNode() *FileTree
Source Files
¶
Click to show internal directories.
Click to hide internal directories.